aboutsummaryrefslogtreecommitdiff
path: root/claude-templates/.ai/scripts/tests/lint-org-cli.bats
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-07-14 01:27:17 -0500
committerCraig Jennings <c@cjennings.net>2026-07-14 01:27:17 -0500
commit951b6fc63129577a80e1d46f46eeafff005fe636 (patch)
treeb5ecd33ae60971ad23448d4b20ef1e3edf488923 /claude-templates/.ai/scripts/tests/lint-org-cli.bats
parentf573c35885583900e3e319cea384606c4e0321cf (diff)
downloadrulesets-951b6fc63129577a80e1d46f46eeafff005fe636.tar.gz
rulesets-951b6fc63129577a80e1d46f46eeafff005fe636.zip
fix(scripts): stop org table helpers rewriting block content
Both helpers treated any pipe-led line as a table row, so ASCII art in an example block got mangled into a bordered table (a work file took a 1949-line reformat on 2026-07-09). The scanners now track the open block's type and skip its content. Only the matching end marker closes a block, so a literal end_src quoted inside an example block can't re-expose it. The deeper cause was wrap-org-table's load-time dispatch: it fired when lint-org merely required the library, running the reformatter over files lint-org was only asked to report on. It now dispatches only when named as the entry script. lint-org's CLI is also report-only by default now. Writes require --fix, and the wrap-up workflow and lint command pass it.
Diffstat (limited to 'claude-templates/.ai/scripts/tests/lint-org-cli.bats')
-rw-r--r--claude-templates/.ai/scripts/tests/lint-org-cli.bats18
1 files changed, 18 insertions, 0 deletions
diff --git a/claude-templates/.ai/scripts/tests/lint-org-cli.bats b/claude-templates/.ai/scripts/tests/lint-org-cli.bats
index d457696..b9faef6 100644
--- a/claude-templates/.ai/scripts/tests/lint-org-cli.bats
+++ b/claude-templates/.ai/scripts/tests/lint-org-cli.bats
@@ -20,6 +20,24 @@ teardown() {
[[ "$output" == *"lint-org: file="* ]]
}
+@test "lint-org.el default invocation is report-only — file untouched" {
+ # bare #+begin_src is a mechanical fix (→ #+begin_example) that the old
+ # default applied on disk; a linter reports, it doesn't write
+ printf '* H\n\n#+begin_src\nx\n#+end_src\n' > "$TMPFILE"
+ before="$(cat "$TMPFILE")"
+ run emacs --batch -q -l "$SCRIPTS_DIR/lint-org.el" "$TMPFILE"
+ [ "$status" -eq 0 ]
+ [[ "$output" == *"would-fix"* ]]
+ [ "$(cat "$TMPFILE")" = "$before" ]
+}
+
+@test "lint-org.el --fix applies mechanical fixes on disk" {
+ printf '* H\n\n#+begin_src\nx\n#+end_src\n' > "$TMPFILE"
+ run emacs --batch -q -l "$SCRIPTS_DIR/lint-org.el" --fix "$TMPFILE"
+ [ "$status" -eq 0 ]
+ grep -q '#+begin_example' "$TMPFILE"
+}
+
@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 ]