diff options
| author | Craig Jennings <c@cjennings.net> | 2026-06-11 14:58:59 -0500 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-06-11 14:58:59 -0500 |
| commit | 6f575e64b1e9f5d9332db73b1e6427d500f90f48 (patch) | |
| tree | e6790058845456c730fcb0a48f3e6d3368beb22b /.ai/scripts/tests | |
| parent | 8d790f371e54a8cc3e79a5ce72cd4dd5b3fa4513 (diff) | |
| download | rulesets-6f575e64b1e9f5d9332db73b1e6427d500f90f48.tar.gz rulesets-6f575e64b1e9f5d9332db73b1e6427d500f90f48.zip | |
fix(scripts): lint-org resolves wrap-org-table from its own directory
Consumers load lint-org with a bare -l and no load-path flag, so the new require of wrap-org-table failed everywhere outside make test's -L. lint-org now adds its own directory to load-path first. lint-org-cli.bats locks the bare-load contract for both scripts.
Diffstat (limited to '.ai/scripts/tests')
| -rw-r--r-- | .ai/scripts/tests/lint-org-cli.bats | 27 |
1 files changed, 27 insertions, 0 deletions
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"* ]] +} |
