-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
Description
If I create two test functions where the name of the second is a subset of the first, the second will get reported with the same line as the first in the test runner. To reproduce, make a test with these two test functions:
void test_my_function_invalid_behavior(void)
{}
void test_my_function(void)
{}
Creates output
test_file.c:test_my_function_invalid_behavior:11:PASS
test_file.c:test_my_function:11:PASS
Note that the second must be a subset of the first, and there can't be any other test-functions between them.
The issue comes from this line:
Unity/auto/generate_test_runner.rb
Line 122 in a868b2e
next unless line =~ /#{tests_and_line_numbers[i][:test]}/ |
This regex either needs an added white space and opening parenthesis here, to ensure that we're matching to the end of the function, or the source index iteration should be source_index += index + 1
on line 123, to avoid matching on the same function twice.