From 3e472491c9b18372fa4ad9da684f291912afe810 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sat, 22 Jan 2011 18:53:23 +0000 Subject: [PATCH] - added ability to parse fun characters like parenthesis in TEST_CASES - fixed TEST_CASE error git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@115 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e --- auto/generate_test_runner.rb | 7 ++++++- test/testparameterized.c | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 2d4ac33..40d73c6 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -75,9 +75,14 @@ class UnityTestRunnerGenerator lines.each_with_index do |line, index| #find tests if line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+(test.*?)\s*\(\s*(.*)\s*\)/ + arguments = $1 name = $2 call = $3 - args = (@options[:use_param_tests] and $1) ? ($1.gsub(/\s*TEST_CASE\s*\(\s*/,'').strip.split(/\s*\)/).compact) : nil + args = nil + if (@options[:use_param_tests] and !arguments.empty?) + args = [] + arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) {|a| args << a[0]} + end tests_and_line_numbers << { :name => name, :args => args, :call => call, :line_number => 0 } tests_args = [] end diff --git a/test/testparameterized.c b/test/testparameterized.c index a267e9f..3192c5d 100644 --- a/test/testparameterized.c +++ b/test/testparameterized.c @@ -52,7 +52,7 @@ void tearDown(void) TEST_CASE(0) TEST_CASE(44) -TEST_CASE(99) +TEST_CASE((90)+9) void test_TheseShouldAllPass(int Num) { TEST_ASSERT_TRUE(Num < 100); @@ -60,7 +60,7 @@ void test_TheseShouldAllPass(int Num) TEST_CASE(3) TEST_CASE(77) -TEST_CASE(99) +TEST_CASE( (99) + 1 - (1)) void test_TheseShouldAllFail(int Num) { EXPECT_ABORT_BEGIN -- GitLab