From ab7e322a0441b2bd68047f7bbbb258600a059f3c Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Tue, 21 Jul 2015 09:37:26 -0400 Subject: [PATCH] protect against capturing both declaration and definitions and therefore creating a runner which runs that test twice. --- auto/generate_test_runner.rb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 7caf1bd..c528e77 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -80,8 +80,6 @@ class UnityTestRunnerGenerator end def find_tests(source) - tests_raw = [] - tests_args = [] tests_and_line_numbers = [] source_scrubbed = source.gsub(/\/\/.*$/, '') # remove line comments @@ -101,9 +99,9 @@ class UnityTestRunnerGenerator arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} end tests_and_line_numbers << { :test => name, :args => args, :call => call, :line_number => 0 } - tests_args = [] end end + tests_and_line_numbers.uniq! {|v| v[:test] } #determine line numbers and create tests to run source_lines = source.split("\n")