Problem
assert_file_contains takes "file" "search" (per docs/assertions.md:1105).
Three examples in the guide users copy from have them the other way round:
assert_file_contains "john@example.com""$TEST_DB/users.txt"# line 130
assert_file_contains "Error occurred""$TEST_LOG"# line 255
assert_file_contains "John Doe""$TEST_DB/users.csv"# line 662
Copied verbatim, bashunit looks for a file literally named Error occurred and
the test fails with Expected 'Error occurred' — which reads like the content
was missing, not like the arguments were backwards.
Executed to confirm, then corrected and re-run: the fixed form passes.
Also, one line down
# Check for timestamp pattern (YYYY-MM-DD HH:MM:SS)
assert_matches "[0-9]{4}-...""$TEST_LOG"That matches the pattern against the path, not the file's contents, so it
never checks what the comment says it does. Needs "$(cat "$TEST_LOG")".
How it surfaced
Executing the guides rather than reading them — the same pass that found #1207.
Argument order is invisible to a name-parity guard: every symbol here exists and
is spelled correctly.
Problem
assert_file_containstakes"file" "search"(perdocs/assertions.md:1105).Three examples in the guide users copy from have them the other way round:
Copied verbatim, bashunit looks for a file literally named
Error occurredandthe test fails with
Expected 'Error occurred'— which reads like the contentwas missing, not like the arguments were backwards.
Executed to confirm, then corrected and re-run: the fixed form passes.
Also, one line down
That matches the pattern against the path, not the file's contents, so it
never checks what the comment says it does. Needs
"$(cat "$TEST_LOG")".How it surfaced
Executing the guides rather than reading them — the same pass that found #1207.
Argument order is invisible to a name-parity guard: every symbol here exists and
is spelled correctly.