diff --git a/lib/cmock_generator.rb b/lib/cmock_generator.rb index 86ee977..0dcec53 100644 --- a/lib/cmock_generator.rb +++ b/lib/cmock_generator.rb @@ -19,10 +19,10 @@ class CMockGenerator @ordered = @config.enforce_strict_ordering @framework = @config.framework.to_s - @includes_h_pre_orig_header = @config.includes || @config.includes_h_pre_orig_header || [] - @includes_h_post_orig_header = @config.includes_h_post_orig_header || [] - @includes_c_pre_header = @config.includes_c_pre_header || [] - @includes_c_post_header = @config.includes_c_post_header || [] + @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map{|h| h =~ /\n" file << "#include \"#{@framework}.h\"\n" file << "#include \"cmock.h\"\n" - @includes_c_pre_header.each {|inc| file << "#include \"#{inc}\"\n"} + @includes_c_pre_header.each {|inc| file << "#include #{inc}\n"} file << "#include \"#{header_file}\"\n" - @includes_c_post_header.each {|inc| file << "#include \"#{inc}\"\n"} + @includes_c_post_header.each {|inc| file << "#include #{inc}\n"} file << "\n" end diff --git a/test/system/systest_generator.rb b/test/system/systest_generator.rb index 6b81218..bbc8320 100644 --- a/test/system/systest_generator.rb +++ b/test/system/systest_generator.rb @@ -47,7 +47,7 @@ class SystemTestGenerator cmock = cmock_yaml[:cmock] cmock[:mock_path] = GENERATED_PATH - cmock[:includes] = [namix + TYPES_H] + cmock[:includes] = (cmock[:includes] || []) + [namix + TYPES_H] cmock[:mock_prefix] = MOCK_PREFIX if not yaml_hash[:systest][:unity_helper].nil? cmock[:includes] << namix + UNITY_HELPER_H diff --git a/test/system/test_interactions/newer_standards_stuff1.yml b/test/system/test_interactions/newer_standards_stuff1.yml new file mode 100644 index 0000000..6843eae --- /dev/null +++ b/test/system/test_interactions/newer_standards_stuff1.yml @@ -0,0 +1,52 @@ +--- +#The purpose of this test is to pull in some standard library stuff from C99 +:cmock: + :includes: + - "" + - "" + +:systest: + :types: | + #include + #include + + + :mockable: | + int32_t foo(int32_t a); + + :source: + :header: | + int8_t function_a(void); + + :code: | + int8_t function_a(void) { + return (int8_t)(INT_MIN == foo(INT_MAX)); + } + + :tests: + :common: | + void setUp(void) {} + void tearDown(void) {} + + :units: + - :pass: TRUE + :should: 'handle handle a simple comparison of C99 types which pass' + :code: | + test() + { + foo_ExpectAndReturn(INT_MAX, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + + - :pass: FALSE + :should: 'handle handle a simple comparison of C99 types which fail' + :code: | + test() + { + foo_ExpectAndReturn(INT_MIN, INT_MIN); + + TEST_ASSERT_TRUE(function_a()); + } + +...