Skip to content

Commit b51303a

Browse files
author
Jannis Baudisch
committed
Improve regex for test parameterization to support function pointers
The regex to match function names for the test parameterization used the wildcard '.*'. This lead to an error when you try to add a function pointer as arguement. The regex will now only match the word characters a-z A-Z 0-9 and underscore (which are all characers that are accepted by the C standard)
1 parent 61f4428 commit b51303a

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

auto/generate_test_runner.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ def find_tests(source)
131131
lines.each_with_index do |line, _index|
132132
# find tests
133133
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
134+
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]})\w*)\s*\(\s*(.*)\s*\)/m
134135

135136
arguments = Regexp.last_match(1)
136137
name = Regexp.last_match(2)

0 commit comments

Comments
 (0)