diff --git a/auto/generate_test_runner.rb b/auto/generate_test_runner.rb index 8be4135..3314016 100644 --- a/auto/generate_test_runner.rb +++ b/auto/generate_test_runner.rb @@ -203,6 +203,7 @@ class UnityTestRunnerGenerator va_args1 = @options[:use_param_tests] ? ', ...' : '' va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : '' output.puts("\n//=======Test Runner Used To Run Each Test Below=====") + output.puts("#define RUN_TEST_NO_ARGS") if @options[:use_param_tests] output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\") output.puts("{ \\") output.puts(" Unity.CurrentTestName = #TestFunc; \\") @@ -246,12 +247,16 @@ class UnityTestRunnerGenerator output.puts(" suite_setup();") unless @options[:suite_setup].nil? output.puts(" Unity.TestFile = \"#{filename}\";") output.puts(" UnityBegin();") - tests.each do |test| - if ((test[:args].nil?) or (test[:args].empty?)) - output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") - else - test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + if (@options[:use_param_tests]) + tests.each do |test| + if ((test[:args].nil?) or (test[:args].empty?)) + output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);") + else + test[:args].each {|args| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]}, #{args});")} + end end + else + tests.each { |test| output.puts(" RUN_TEST(#{test[:name]}, #{test[:line_number]});") } end output.puts() output.puts(" return #{@options[:suite_teardown].nil? ? "" : "suite_teardown"}(UnityEnd());") diff --git a/extras/fixture/rakefile_helper.rb b/extras/fixture/rakefile_helper.rb index 7e7c801..01a5d66 100644 --- a/extras/fixture/rakefile_helper.rb +++ b/extras/fixture/rakefile_helper.rb @@ -8,16 +8,19 @@ require 'yaml' require 'fileutils' require HERE+'../../auto/unity_test_summary' require HERE+'../../auto/generate_test_runner' -require HERE+'../../auto/colour_reporter' +require HERE+'../../auto/colour_reporter' module RakefileHelpers C_EXTENSION = '.c' def load_configuration(config_file) - $cfg_file = HERE+"../../targets/#{config_file}" unless $cfg_file =~ /[\\|\/]/ - $cfg = YAML.load(File.read($cfg_file)) - $colour_output = false unless $cfg['colour'] + unless ($configured) + $cfg_file = HERE+"../../targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end end def configure_clean @@ -159,7 +162,7 @@ module RakefileHelpers simulator = build_simulator_fields executable = $cfg['linker']['bin_files']['destination'] + test_base + $cfg['linker']['bin_files']['extension'] if simulator.nil? - cmd_str = executable + " -v -r 8" + cmd_str = executable + " -v -r" else cmd_str = "#{simulator[:command]} #{simulator[:pre_support]} #{executable} #{simulator[:post_support]}" end @@ -171,6 +174,5 @@ module RakefileHelpers test_results += '.testpass' end File.open(test_results, 'w') { |f| f.print output } - puts output end end diff --git a/extras/fixture/test/unity_fixture_Test.c b/extras/fixture/test/unity_fixture_Test.c index 915f6e8..7cb86a4 100644 --- a/extras/fixture/test/unity_fixture_Test.c +++ b/extras/fixture/test/unity_fixture_Test.c @@ -297,7 +297,7 @@ TEST(LeakDetection, BufferOverrunFoundDuringFree) { void* m = malloc(10); char* s = (char*)m; - s[10] = -1; + s[10] = (char)0xFF; UnityOutputCharSpy_Enable(1); EXPECT_ABORT_BEGIN free(m); @@ -312,7 +312,7 @@ TEST(LeakDetection, BufferOverrunFoundDuringRealloc) { void* m = malloc(10); char* s = (char*)m; - s[10] = -1; + s[10] = (char)0xFF; UnityOutputCharSpy_Enable(1); EXPECT_ABORT_BEGIN m = realloc(m, 100); diff --git a/extras/fixture/test/unity_output_Spy.c b/extras/fixture/test/unity_output_Spy.c index 764ee9f..16faefa 100644 --- a/extras/fixture/test/unity_output_Spy.c +++ b/extras/fixture/test/unity_output_Spy.c @@ -7,6 +7,7 @@ #include "unity_output_Spy.h" +#include #include #include diff --git a/rakefile_helper.rb b/rakefile_helper.rb index f868039..537aa18 100644 --- a/rakefile_helper.rb +++ b/rakefile_helper.rb @@ -15,9 +15,12 @@ module RakefileHelpers C_EXTENSION = '.c' def load_configuration(config_file) - $cfg_file = "targets/#{config_file}" unless $cfg_file =~ /[\\|\/]/ - $cfg = YAML.load(File.read($cfg_file)) - $colour_output = false unless $cfg['colour'] + unless ($configured) + $cfg_file = "targets/#{config_file}" unless (config_file =~ /[\\|\/]/) + $cfg = YAML.load(File.read($cfg_file)) + $colour_output = false unless $cfg['colour'] + $configured = true if (config_file != DEFAULT_CONFIG_FILE) + end end def configure_clean diff --git a/src/unity_internals.h b/src/unity_internals.h index e95bc36..28d595d 100644 --- a/src/unity_internals.h +++ b/src/unity_internals.h @@ -120,6 +120,8 @@ typedef UNITY_FLOAT_TYPE _UF; #define UNITY_OUTPUT_CHAR(a) putchar(a) #endif +extern int UNITY_OUTPUT_CHAR(int); + //------------------------------------------------------- // Footprint //------------------------------------------------------- diff --git a/test/expectdata/testsample_mock_param.c b/test/expectdata/testsample_mock_param.c index 4ea583e..5953a25 100644 --- a/test/expectdata/testsample_mock_param.c +++ b/test/expectdata/testsample_mock_param.c @@ -1,6 +1,7 @@ /* AUTOGENERATED FILE. DO NOT EDIT. */ //=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS #define RUN_TEST(TestFunc, TestLineNum, ...) \ { \ Unity.CurrentTestName = #TestFunc; \ @@ -65,8 +66,8 @@ int main(void) { Unity.TestFile = "test/testdata/mocksample.c"; UnityBegin(); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); return (UnityEnd()); } diff --git a/test/expectdata/testsample_param.c b/test/expectdata/testsample_param.c index a367d50..e59579b 100644 --- a/test/expectdata/testsample_param.c +++ b/test/expectdata/testsample_param.c @@ -1,6 +1,7 @@ /* AUTOGENERATED FILE. DO NOT EDIT. */ //=======Test Runner Used To Run Each Test Below===== +#define RUN_TEST_NO_ARGS #define RUN_TEST(TestFunc, TestLineNum, ...) \ { \ Unity.CurrentTestName = #TestFunc; \ @@ -43,8 +44,8 @@ int main(void) { Unity.TestFile = "test/testdata/testsample.c"; UnityBegin(); - RUN_TEST(test_TheFirstThingToTest, 21); - RUN_TEST(test_TheSecondThingToTest, 43); + RUN_TEST(test_TheFirstThingToTest, 21, RUN_TEST_NO_ARGS); + RUN_TEST(test_TheSecondThingToTest, 43, RUN_TEST_NO_ARGS); return (UnityEnd()); }