Skip to content

Commit 63fef7d

Browse files
committed
Enlarge the TEST_RANGE() regex to accept more spaces
This commit change the regex to accept more spaces inside the brackets of the TEST_RANGE(). I use clang-format through vscode "editor.formatOnSave": true feature and it produce padding spaces inside the array brackets by default. ```c int a[] = [1, 2]; ``` is changed into ```c int a[] = [ 1, 2 ]; ``` Also, every time I save a file containing a TEST_RANGE() with ctrl + s, it breaks it.
1 parent 78dea55 commit 63fef7d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

auto/generate_test_runner.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def find_tests(source)
143143
arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) { |a| args << a[0] }
144144

145145
arguments.scan(/\s*TEST_RANGE\s*\((.*)\)\s*$/).flatten.each do |range_str|
146-
args += range_str.scan(/\[(-?\d+.?\d*), *(-?\d+.?\d*), *(-?\d+.?\d*)\]/).map do |arg_values_str|
146+
args += range_str.scan(/\[\s*(-?\d+.?\d*),\s*(-?\d+.?\d*),\s*(-?\d+.?\d*)\s*\]/).map do |arg_values_str|
147147
arg_values_str.map do |arg_value_str|
148148
arg_value_str.include?('.') ? arg_value_str.to_f : arg_value_str.to_i
149149
end

0 commit comments

Comments
 (0)