From b51303a65b93fc5f4d8598d280f414d0535fb2ce Mon Sep 17 00:00:00 2001 From: Jannis Baudisch Date: Thu, 1 Apr 2021 10:29:22 +0200 Subject: [PATCH] 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) --- auto/generate_test_runner.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index d1d8f91..7497c6d 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -131,6 +131,7 @@ class UnityTestRunnerGenerator lines.each_with_index do |line, _index| # 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]})\w*)\s*\(\s*(.*)\s*\)/m arguments = Regexp.last_match(1) name = Regexp.last_match(2)