From 7761b3fb3fdc934aa17a824a00744f568036581b Mon Sep 17 00:00:00 2001 From: Mark VanderVoord Date: Tue, 9 Jul 2019 10:50:29 -0400 Subject: [PATCH] automatically pull in unity helper into tests when specified in both example and cmock's includes. --- examples/temp_sensor/rakefile_helper.rb | 4 ++-- lib/cmock_config.rb | 1 + release/version.info | 2 +- test/rakefile_helper.rb | 1 + test/system/systest_generator.rb | 1 - .../test_interactions/expect_and_return_custom_types.yml | 2 +- 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/temp_sensor/rakefile_helper.rb b/examples/temp_sensor/rakefile_helper.rb index 61d2377..d9da2e0 100644 --- a/examples/temp_sensor/rakefile_helper.rb +++ b/examples/temp_sensor/rakefile_helper.rb @@ -185,8 +185,8 @@ module RakefileHelpers obj_list = [] # Detect dependencies and build required required modules - header_list = extract_headers(test) + ['cmock.h'] - header_list.each do |header| + header_list = extract_headers(test) + ['cmock.h'] + [ cfg[:cmock][:unity_helper_path] ] + header_list.compact.uniq.each do |header| #create mocks if needed if (header =~ /Mock/) diff --git a/lib/cmock_config.rb b/lib/cmock_config.rb index a75a454..2825b59 100644 --- a/lib/cmock_config.rb +++ b/lib/cmock_config.rb @@ -64,6 +64,7 @@ class CMockConfig end options[:unity_helper_path] ||= options[:unity_helper] options[:unity_helper_path] = [options[:unity_helper_path]] if options[:unity_helper_path].is_a? String + options[:includes_c_post_header] = ((options[:includes_c_post_header] || []) + (options[:unity_gelper_path] || [])).uniq options[:plugins].compact! options[:plugins].map! {|p| p.to_sym} @options = options diff --git a/release/version.info b/release/version.info index 1b6799f..0c387a9 100644 --- a/release/version.info +++ b/release/version.info @@ -1,2 +1,2 @@ -2.4.6 +2.4.7 diff --git a/test/rakefile_helper.rb b/test/rakefile_helper.rb index b00ab20..4481696 100644 --- a/test/rakefile_helper.rb +++ b/test/rakefile_helper.rb @@ -50,6 +50,7 @@ module RakefileHelpers includes << m[1] end end + includes << File.basename(filename,".c").slice(5,256) + "_unity_helper.h" return includes end diff --git a/test/system/systest_generator.rb b/test/system/systest_generator.rb index 3d63b31..b2205d3 100644 --- a/test/system/systest_generator.rb +++ b/test/system/systest_generator.rb @@ -104,7 +104,6 @@ class SystemTestGenerator return if tests.nil? includes = [UNITY_H, CMOCK_H] - includes << (namix + UNITY_HELPER_H) if not yaml_hash[:systest][:unity_helper].nil? includes << [MOCK_PREFIX + namix + MOCKABLE_H] includes << [name + H_EXTENSION] diff --git a/test/system/test_interactions/expect_and_return_custom_types.yml b/test/system/test_interactions/expect_and_return_custom_types.yml index ae946d9..5d9d446 100644 --- a/test/system/test_interactions/expect_and_return_custom_types.yml +++ b/test/system/test_interactions/expect_and_return_custom_types.yml @@ -3,6 +3,7 @@ :plugins: - # none :memcmp_if_unknown: false + :unity_helper_path: expect_and_return_custom_types_unity_helper.h :systest: :types: | @@ -35,7 +36,6 @@ :tests: :common: | - #include "expect_and_return_custom_types_unity_helper.h" void setUp(void) {} void tearDown(void) {}