Skip to content

docs(test-files): state the real test-function name rule - #1216

Merged
Chemaclass merged 1 commit into
mainfrom
docs/1215-test-function-name-rule
Aug 14, 2026
Merged

docs(test-files): state the real test-function name rule#1216
Chemaclass merged 1 commit into
mainfrom
docs/1215-test-function-name-rule

Conversation

@Chemaclass

Copy link
Copy Markdown
Member

🤔 Background

Related #1215

docs/test-files.md listed function testRenderAllTestsPassedWhenNotFailedTests { ... } as a working example and stated that test function names are case-insensitive. The matcher requires a literal, lowercase test_, so a function named either way is never collected — and when the file also holds a real test, the run is green with fewer tests than the user wrote.

💡 Changes

  • State the rule the code implements, and move the "any Bash syntax works" freedom onto the definition style, which is what it actually applies to — the corrected examples cover all three styles and all run
  • Add a warning that non-matching names are silently treated as helpers, pointing at --list as the way to check
  • Pin the matcher with an acceptance test covering both directions, mutation-checked against a relaxed prefix and against nocasematch
  • Leave the matcher unchanged on purpose: a bare test prefix would start collecting helpers such as testdata_path as tests

The guide listed `function testRenderAllTestsPassedWhenNotFailedTests { ... }`
as a working example and claimed function names are case-insensitive. Neither
is true: `get_functions_to_run` matches `${prefix}_*`, a literal lowercase
`test_`, so both that name and `TEST_upper` are treated as auxiliary functions.

Nothing warns about it. A file mixing one of those with a real test runs green
with fewer tests than it defines; only a file made entirely of them is caught,
by "No tests found".

Correct the rule, attribute the definition-style freedom to the syntax rather
than the name, warn about the silent skip, and pin the matcher's actual
behaviour with an acceptance test. The matcher is left alone deliberately:
accepting a bare `test` prefix would start collecting helpers like
`testdata_path` as tests.

Closes #1215
@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 e20d72c into main Aug 14, 2026
37 checks passed
@Chemaclass
Chemaclass deleted the docs/1215-test-function-name-rule branch August 14, 2026 06:36
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