diff options
| -rw-r--r-- | .ai/scripts/lint-org.el | 8 | ||||
| -rw-r--r-- | .ai/scripts/tests/lint-org-cli.bats | 27 | ||||
| -rw-r--r-- | claude-templates/.ai/scripts/lint-org.el | 8 | ||||
| -rw-r--r-- | claude-templates/.ai/scripts/tests/lint-org-cli.bats | 27 |
4 files changed, 70 insertions, 0 deletions
diff --git a/.ai/scripts/lint-org.el b/.ai/scripts/lint-org.el index 5d47644..05365fe 100644 --- a/.ai/scripts/lint-org.el +++ b/.ai/scripts/lint-org.el @@ -42,6 +42,14 @@ (require 'org-lint) (require 'cl-lib) (require 'subr-x) + +;; wrap-org-table.el lives beside this file. Consumers load lint-org with a +;; bare `-l path/lint-org.el` (wrap-it-up, /lint-org) — no -L on the load +;; path — so resolve the sibling from this file's own directory. +(eval-and-compile + (add-to-list 'load-path + (file-name-directory (or load-file-name buffer-file-name + default-directory)))) (require 'wrap-org-table) ; render-width + table parsing for the table check (defvar lo-fixes 0 diff --git a/.ai/scripts/tests/lint-org-cli.bats b/.ai/scripts/tests/lint-org-cli.bats new file mode 100644 index 0000000..d457696 --- /dev/null +++ b/.ai/scripts/tests/lint-org-cli.bats @@ -0,0 +1,27 @@ +#!/usr/bin/env bats +# lint-org.el must load standalone via `emacs --batch -q -l <path>` with no +# -L flag — that's how wrap-it-up and the /lint-org command invoke it. The +# require of wrap-org-table broke that once: the dependency resolved under +# make test's -L .ai/scripts but not from a bare -l load. + +setup() { + SCRIPTS_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)" + TMPFILE="$(mktemp --suffix=.org)" + printf '* H\n\n| a |\n|---|\n| ok |\n|---|\n' > "$TMPFILE" +} + +teardown() { + rm -f "$TMPFILE" +} + +@test "lint-org.el loads and runs without -L on the load path" { + run emacs --batch -q -l "$SCRIPTS_DIR/lint-org.el" --check "$TMPFILE" + [ "$status" -eq 0 ] + [[ "$output" == *"lint-org: file="* ]] +} + +@test "wrap-org-table.el loads and runs without -L on the load path" { + run emacs --batch -q -l "$SCRIPTS_DIR/wrap-org-table.el" --width=120 "$TMPFILE" + [ "$status" -eq 0 ] + [[ "$output" == *"reformatted"* ]] +} diff --git a/claude-templates/.ai/scripts/lint-org.el b/claude-templates/.ai/scripts/lint-org.el index 5d47644..05365fe 100644 --- a/claude-templates/.ai/scripts/lint-org.el +++ b/claude-templates/.ai/scripts/lint-org.el @@ -42,6 +42,14 @@ (require 'org-lint) (require 'cl-lib) (require 'subr-x) + +;; wrap-org-table.el lives beside this file. Consumers load lint-org with a +;; bare `-l path/lint-org.el` (wrap-it-up, /lint-org) — no -L on the load +;; path — so resolve the sibling from this file's own directory. +(eval-and-compile + (add-to-list 'load-path + (file-name-directory (or load-file-name buffer-file-name + default-directory)))) (require 'wrap-org-table) ; render-width + table parsing for the table check (defvar lo-fixes 0 diff --git a/claude-templates/.ai/scripts/tests/lint-org-cli.bats b/claude-templates/.ai/scripts/tests/lint-org-cli.bats new file mode 100644 index 0000000..d457696 --- /dev/null +++ b/claude-templates/.ai/scripts/tests/lint-org-cli.bats @@ -0,0 +1,27 @@ +#!/usr/bin/env bats +# lint-org.el must load standalone via `emacs --batch -q -l <path>` with no +# -L flag — that's how wrap-it-up and the /lint-org command invoke it. The +# require of wrap-org-table broke that once: the dependency resolved under +# make test's -L .ai/scripts but not from a bare -l load. + +setup() { + SCRIPTS_DIR="$(cd "$(dirname "$BATS_TEST_FILENAME")/.." && pwd)" + TMPFILE="$(mktemp --suffix=.org)" + printf '* H\n\n| a |\n|---|\n| ok |\n|---|\n' > "$TMPFILE" +} + +teardown() { + rm -f "$TMPFILE" +} + +@test "lint-org.el loads and runs without -L on the load path" { + run emacs --batch -q -l "$SCRIPTS_DIR/lint-org.el" --check "$TMPFILE" + [ "$status" -eq 0 ] + [[ "$output" == *"lint-org: file="* ]] +} + +@test "wrap-org-table.el loads and runs without -L on the load path" { + run emacs --batch -q -l "$SCRIPTS_DIR/wrap-org-table.el" --width=120 "$TMPFILE" + [ "$status" -eq 0 ] + [[ "$output" == *"reformatted"* ]] +} |
