Skip to content

Keep commas in parentheses in test name filters - #852

Merged
mvandervoord merged 1 commit into
ThrowTheSwitch:masterfrom
jadhavgaurav:fix/test-filter-comma-in-name-779
Oct 31, 2026
Merged

mvandervoord merged 1 commit into
ThrowTheSwitch:masterfrom
jadhavgaurav:fix/test-filter-comma-in-name-779

Conversation

@jadhavgaurav

Copy link
Copy Markdown
Contributor

The -f, -n and -x filters split their argument at every comma, so test_first(0,0) was read as the two alternatives test_first(0 and 0). With -f this ran unrelated tests such as test_second(0,0), and with -n it ran none.

A comma nested inside parentheses is now part of the name, in both UnityStringArgumentMatches (where the list is split) and IsStringInBiggerString (where a comma ends a match). Comma-separated lists like -f "a,b" work as before. An unbalanced ( keeps the rest of the argument as one name.

Tests: five cases in test_generate_test_runner.rb against a new testRunnerGeneratorParameterizedArgs.c (include, exact match, no match, comma-separated alternatives mixing parameterized and plain names, exclude). All five fail without the change to src/unity.c. rake test:scripts, test:unit, test:fixture, test:memory, test:summary and test:make pass. test:style was not run locally because rubocop and astyle are not installed.

Fixes #779

@jadhavgaurav

Copy link
Copy Markdown
Contributor Author

Gentle ping. This keeps commas inside parentheses in the -f, -n and -x test name filters (#779), with five runner-generator test cases. The CI workflow on this PR shows as waiting for maintainer approval, so it has not run yet. Could someone approve it when convenient? Happy to adjust anything.

The -f, -n and -x filters split their argument at every comma, so a
parameterized test name such as test_first(0,0) was treated as the two
alternatives "test_first(0" and "0)". This ran unrelated tests with -f
and no tests at all with -n.

A comma nested inside parentheses is now part of the name. Plain
comma-separated lists behave as before.

Fixes ThrowTheSwitch#779

Signed-off-by: Gaurav Jadhav <gaurav.vjadhav01@gmail.com>
@jadhavgaurav
jadhavgaurav force-pushed the fix/test-filter-comma-in-name-779 branch from 2a162d5 to 8042f6c Compare October 31, 2026 06:12
@jadhavgaurav

Copy link
Copy Markdown
Contributor Author

Rebased onto the current master. The only conflict was in docs/UnityChangeLog.md, where I kept both entries (#752 and #779). rake test:scripts (81 tests) and rake test:unit pass after the rebase.

@mvandervoord
mvandervoord merged commit 54f864c into ThrowTheSwitch:master Oct 31, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

UnityStringArgumentMatches doesn't seem to work properly for parameterized tests

2 participants