From aca98924186f38f35d7c8c58ef4325e4f503f714 Mon Sep 17 00:00:00 2001 From: mvandervoord Date: Sat, 22 Jan 2011 18:20:39 +0000 Subject: [PATCH] - fixed yaml load option - added option to specify includes as so that they will get angle brackets instead of "" git-svn-id: http://unity.svn.sourceforge.net/svnroot/unity/trunk@114 e7d17a6e-8845-0410-bbbc-c8efb4fdad7e --- auto/generate_test_runner.rb | 8 ++++---- test/expectdata/testsample_mock_yaml.c | 7 +++++++ test/expectdata/testsample_yaml.c | 7 +++++++ test/testdata/sample.yml | 3 ++- 4 files changed, 20 insertions(+), 5 deletions(-) diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 482b381..2d4ac33 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -123,8 +123,8 @@ class UnityTestRunnerGenerator output.puts("\n//=======Automagically Detected Files To Include=====") output.puts("#include \"#{@options[:framework].to_s}.h\"") output.puts('#include "cmock.h"') unless (mocks.empty?) - @options[:includes].flatten.uniq.compact.each do |includes| - output.puts("#include \"#{includes.gsub('.h','')}.h\"") + @options[:includes].flatten.uniq.compact.each do |inc| + output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}") end output.puts('#include ') output.puts('#include ') @@ -274,7 +274,7 @@ if ($0 == __FILE__) case(arg) when '-cexception' options[:plugins] = [:cexception]; true - when /\w+\.yml/ + when /\.*\.yml/ options = UnityTestRunnerGenerator.grab_config(arg); true else false end @@ -292,7 +292,7 @@ if ($0 == __FILE__) ARGV[1] = ARGV[0].gsub(".c","_Runner.c") if (!ARGV[1]) #everything else is an include file - options[:includes] = (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) + options[:includes] ||= (ARGV.slice(2..-1).flatten.compact) if (ARGV.size > 2) UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1]) end diff --git a/test/expectdata/testsample_mock_yaml.c b/test/expectdata/testsample_mock_yaml.c index 3bedff4..00c846c 100644 --- a/test/expectdata/testsample_mock_yaml.c +++ b/test/expectdata/testsample_mock_yaml.c @@ -8,10 +8,13 @@ Unity.NumberOfTests++; \ if (TEST_PROTECT()) \ { \ + CEXCEPTION_T e; \ + Try { \ CMock_Init(); \ setUp(); \ TestFunc(); \ CMock_Verify(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ } \ CMock_Destroy(); \ if (TEST_PROTECT() && !TEST_IS_IGNORED) \ @@ -24,8 +27,12 @@ //=======Automagically Detected Files To Include===== #include "unity.h" #include "cmock.h" +#include "two.h" +#include "three.h" +#include #include #include +#include "CException.h" #include "Mockstanky.h" //=======External Functions This Runner Calls===== diff --git a/test/expectdata/testsample_yaml.c b/test/expectdata/testsample_yaml.c index dbb47f5..eb25bc9 100644 --- a/test/expectdata/testsample_yaml.c +++ b/test/expectdata/testsample_yaml.c @@ -8,8 +8,11 @@ Unity.NumberOfTests++; \ if (TEST_PROTECT()) \ { \ + CEXCEPTION_T e; \ + Try { \ setUp(); \ TestFunc(); \ + } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \ } \ if (TEST_PROTECT() && !TEST_IS_IGNORED) \ { \ @@ -20,8 +23,12 @@ //=======Automagically Detected Files To Include===== #include "unity.h" +#include "two.h" +#include "three.h" +#include #include #include +#include "CException.h" //=======External Functions This Runner Calls===== extern void setUp(void); diff --git a/test/testdata/sample.yml b/test/testdata/sample.yml index 567972d..52ec96b 100644 --- a/test/testdata/sample.yml +++ b/test/testdata/sample.yml @@ -1,7 +1,8 @@ :unity: - :includes + :includes: - two.h - three.h + - :plugins: - :cexception :suite_setup: |