mirror of
https://github.com/ThrowTheSwitch/Unity.git
synced 2025-10-23 18:28:17 +08:00
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)
This commit is contained in:
@@ -131,6 +131,7 @@ class UnityTestRunnerGenerator
|
|||||||
lines.each_with_index do |line, _index|
|
lines.each_with_index do |line, _index|
|
||||||
# find tests
|
# find tests
|
||||||
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
|
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/m
|
||||||
|
next unless line =~ /^((?:\s*(?:TEST_CASE|TEST_RANGE)\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]})\w*)\s*\(\s*(.*)\s*\)/m
|
||||||
|
|
||||||
arguments = Regexp.last_match(1)
|
arguments = Regexp.last_match(1)
|
||||||
name = Regexp.last_match(2)
|
name = Regexp.last_match(2)
|
||||||
|
Reference in New Issue
Block a user