Skip to content

docs(patterns): fix swapped assert_file_contains arguments - #1210

Merged
Chemaclass merged 1 commit into
mainfrom
docs/1209-common-patterns-argument-order
Aug 14, 2026
Merged

docs(patterns): fix swapped assert_file_contains arguments#1210
Chemaclass merged 1 commit into
mainfrom
docs/1209-common-patterns-argument-order

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1209

assert_file_contains takes "file" "search", but three examples in the guide
users copy from had them reversed:

assert_file_contains "Error occurred" "$TEST_LOG"     # looks for a file named "Error occurred"

Copied verbatim it fails with Expected 'Error occurred', which reads as
missing content rather than backwards arguments.

One line below, assert_matches "<timestamp regex>" "$TEST_LOG" matched the
pattern against the path, never the contents its comment described.

💡 Changes

  • Correct the three swapped calls and the assert_matches target
  • Executed each example before and after: originals fail, corrections pass

Argument order is invisible to the docs-parity guards — every symbol exists and
is spelled correctly — so only running the examples finds it. Same pass that
found #1207.

assert_file_contains takes "file" "search", but three examples in the guide
users copy from had them reversed, so bashunit looked for a file literally
named 'Error occurred' and failed with "Expected 'Error occurred'" -- which
reads as missing content rather than backwards arguments.

The line below one of them passed $TEST_LOG to assert_matches, matching the
timestamp pattern against the path instead of the file's contents, so it never
checked what its own comment described.

Executed each example before and after: the originals fail, the corrections
pass.

Argument order is invisible to the docs-parity guards -- every symbol here
exists and is spelled correctly -- so only running the examples finds it.

Closes #1209
@Chemaclass Chemaclass added the documentation Improvements or additions to documentation label Aug 14, 2026
@Chemaclass Chemaclass self-assigned this Aug 14, 2026
@Chemaclass
Chemaclass merged commit 2381ad1 into main Aug 14, 2026
6 checks passed
@Chemaclass
Chemaclass deleted the docs/1209-common-patterns-argument-order branch August 14, 2026 05:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant