Problem
docs/test-files.md "Test function names" makes two claims about which functions bashunit collects. Both are false, and both fail silently when the file also contains a valid test: the function is skipped, the run says All tests passed, and the exit code is 0.
1. The function testFoo { ... } example is never collected
The guide lists three definition styles as working, verbatim:
functiontest_should_validate_an_ok_exit_code() { ... }
functiontestRenderAllTestsPassedWhenNotFailedTests { ... }
test_getFunctionsToRun_with_filter_should_return_matching_functions() { ... }Running exactly those three:
✓ Passed: Should validate an ok exit code
✓ Passed: GetFunctionsToRun with filter should return matching functions
Tests: 2 passed, 2 total
All tests passed
The second one never ran. --list confirms only two are selected. The name has no underscore after test, and bashunit::helper::get_functions_to_run matches case "$fn" in ${prefix}_*${filter}*) — a literal test_ is required. The style (function keyword, no parentheses) is fine; the name is what disqualifies it.
2. "The function names are case-insensitive" is false
functionTEST_upper() { assert_same 1 1; }
functionTest_mixed() { assert_same 1 1; }
functiontEsT_weird() { assert_same 1 1; }Tests: 0 total
No tests found
The case glob is case-sensitive and no nocasematch is set on this path. Here the whole file is empty of matches so the run does exit 1 — but mix one lowercase test in and the uppercase ones vanish with exit 0.
Why it matters
A user following the guide writes camelCase or capitalised test functions and gets a green suite that ran fewer tests than they wrote. There is no warning anywhere.
Suggested fix
Correct the docs to the rule the code implements — the prefix is test_, lowercase, and the underscore is required — and pin it with a regression test so the guide and the matcher cannot drift again.
Changing the matcher instead was considered and not proposed: accepting a bare test prefix would start collecting ordinary helpers (testdata_path, testing_utils) as tests, which is a silent behaviour change for existing suites.
Verified correct in the same guide
The rest of docs/test-files.md was executed and holds: bashunit::set_test_title, all three @timeout/@retry/@skip annotations including @timeout 0 overriding a run-wide --test-timeout, comment lines keeping an annotation block open, a blank line breaking it, invalid annotation values aborting with a named error and exit 1, and the syntax-error contract in both sequential and --parallel modes.
Problem
docs/test-files.md"Test function names" makes two claims about which functions bashunit collects. Both are false, and both fail silently when the file also contains a valid test: the function is skipped, the run saysAll tests passed, and the exit code is 0.1. The
function testFoo { ... }example is never collectedThe guide lists three definition styles as working, verbatim:
Running exactly those three:
The second one never ran.
--listconfirms only two are selected. The name has no underscore aftertest, andbashunit::helper::get_functions_to_runmatchescase "$fn" in ${prefix}_*${filter}*)— a literaltest_is required. The style (functionkeyword, no parentheses) is fine; the name is what disqualifies it.2. "The function names are case-insensitive" is false
The
caseglob is case-sensitive and nonocasematchis set on this path. Here the whole file is empty of matches so the run does exit 1 — but mix one lowercase test in and the uppercase ones vanish with exit 0.Why it matters
A user following the guide writes camelCase or capitalised test functions and gets a green suite that ran fewer tests than they wrote. There is no warning anywhere.
Suggested fix
Correct the docs to the rule the code implements — the prefix is
test_, lowercase, and the underscore is required — and pin it with a regression test so the guide and the matcher cannot drift again.Changing the matcher instead was considered and not proposed: accepting a bare
testprefix would start collecting ordinary helpers (testdata_path,testing_utils) as tests, which is a silent behaviour change for existing suites.Verified correct in the same guide
The rest of
docs/test-files.mdwas executed and holds:bashunit::set_test_title, all three@timeout/@retry/@skipannotations including@timeout 0overriding a run-wide--test-timeout, comment lines keeping an annotation block open, a blank line breaking it, invalid annotation values aborting with a named error and exit 1, and the syntax-error contract in both sequential and--parallelmodes.