Problem
docs/ai-agents.md publishes a "Drop-in rules for your repo" block explicitly meant to be pasted into AGENTS.md / CLAUDE.md. One bullet is wrong:
- Prefer
assert_same (exact) over assert_equals (which trims/normalizes).
assert_equals does not trim. It strips ANSI escape sequences and control characters:
| assertion | result |
|---|
assert_equals "a" " a " | fails — whitespace is not trimmed |
assert_equals "a" "a " | fails |
assert_equals "hello" $'\e[31mhello\e[0m' | passes — colour stripped |
assert_equals "ab" "$(printf 'a\tb')" | passes — tab stripped |
assert_equals "ab" "$(printf 'a\nb')" | passes — newline stripped |
src/assert/core.sh runs both sides through bashunit::str::strip_ansi_to_slot; a space is not a control character, so nothing about whitespace is touched.
Why it matters
An agent whose rules file says "trims" will expect whitespace tolerance that does not exist, and will not learn the thing assert_equals is actually for — comparing coloured CLI output, which is a common need when testing terminal tools. This block is the one part of the docs designed to be copied verbatim into a rules file, so an error here propagates into every repo that adopts it.
docs/assertions.md is correct and says so precisely ("ignoring the special chars like ANSI Escape Sequences (colors) and other special chars like tabs and new lines") — verified, including that a literal backslash-t stays two characters.
Suggested fix
Say what it does. The preference for assert_same is still right; the reason given is not.
Also, cosmetic
The placeholder warning renders a doubled prefix:
Not updating ././snapshots/ph_test_sh.test_ph.snapshot: it contains the placeholder '::ignore::'.
Verified correct in the same guide
Everything else in ai-agents.md was executed and holds: the --report-json/--output json document shape (plus flaky and retries, which the example omits but does not contradict), the documented jq pipeline, --output tap matching the shown TAP 13 block, .bashunit/last-failed and the --rerun-failed loop to termination, all three published URLs (llms.txt, llms-full.txt, bashunit-skill.md), every spy claim including the argument-order asymmetry and _with being unable to tell cmd "a b" from cmd a b while _with_args catches it, the was never registered as a spy message, the placeholder warning on stderr, and the whole exit-code contract — failed non-zero; entirely skipped, incomplete, risky or newly-recorded-snapshot runs all 0; --fail-on-risky and --no-snapshot-create turning the last two red.
Problem
docs/ai-agents.mdpublishes a "Drop-in rules for your repo" block explicitly meant to be pasted intoAGENTS.md/CLAUDE.md. One bullet is wrong:assert_equalsdoes not trim. It strips ANSI escape sequences and control characters:assert_equals "a" " a "assert_equals "a" "a "assert_equals "hello" $'\e[31mhello\e[0m'assert_equals "ab" "$(printf 'a\tb')"assert_equals "ab" "$(printf 'a\nb')"src/assert/core.shruns both sides throughbashunit::str::strip_ansi_to_slot; a space is not a control character, so nothing about whitespace is touched.Why it matters
An agent whose rules file says "trims" will expect whitespace tolerance that does not exist, and will not learn the thing
assert_equalsis actually for — comparing coloured CLI output, which is a common need when testing terminal tools. This block is the one part of the docs designed to be copied verbatim into a rules file, so an error here propagates into every repo that adopts it.docs/assertions.mdis correct and says so precisely ("ignoring the special chars like ANSI Escape Sequences (colors) and other special chars like tabs and new lines") — verified, including that a literal backslash-tstays two characters.Suggested fix
Say what it does. The preference for
assert_sameis still right; the reason given is not.Also, cosmetic
The placeholder warning renders a doubled prefix:
Verified correct in the same guide
Everything else in
ai-agents.mdwas executed and holds: the--report-json/--output jsondocument shape (plusflakyandretries, which the example omits but does not contradict), the documentedjqpipeline,--output tapmatching the shown TAP 13 block,.bashunit/last-failedand the--rerun-failedloop to termination, all three published URLs (llms.txt,llms-full.txt,bashunit-skill.md), every spy claim including the argument-order asymmetry and_withbeing unable to tellcmd "a b"fromcmd a bwhile_with_argscatches it, thewas never registered as a spymessage, the placeholder warning on stderr, and the whole exit-code contract — failed non-zero; entirely skipped, incomplete, risky or newly-recorded-snapshot runs all 0;--fail-on-riskyand--no-snapshot-createturning the last two red.