ceedling 0.31.0 → 0.31.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/assets/example_file_call.c +6 -0
  3. data/assets/example_file_call.h +6 -0
  4. data/assets/test_example_file_with_mock.c +13 -0
  5. data/bin/ceedling +2 -2
  6. data/ceedling.gemspec +1 -1
  7. data/lib/ceedling/configurator.rb +7 -2
  8. data/lib/ceedling/configurator_plugins.rb +21 -1
  9. data/lib/ceedling/defaults.rb +1 -0
  10. data/lib/ceedling/preprocessinator_extractor.rb +2 -0
  11. data/lib/ceedling/preprocessinator_includes_handler.rb +24 -24
  12. data/lib/ceedling/version.rb +11 -7
  13. data/plugins/gcov/config/defaults_gcov.rb +118 -0
  14. data/plugins/gcov/lib/gcovr_reportinator.rb +1 -1
  15. data/plugins/gcov/lib/reportgenerator_reportinator.rb +1 -1
  16. data/plugins/junit_tests_report/lib/junit_tests_report.rb +6 -6
  17. data/plugins/module_generator/README.md +16 -2
  18. data/plugins/module_generator/lib/module_generator.rb +1 -0
  19. data/spec/gcov/gcov_deployment_spec.rb +1 -1
  20. data/spec/preprocessinator_includes_handler_spec.rb +38 -8
  21. data/spec/spec_system_helper.rb +19 -0
  22. data/spec/system/deployment_spec.rb +1 -0
  23. data/vendor/cmock/lib/cmock_file_writer.rb +2 -3
  24. data/vendor/cmock/lib/cmock_generator.rb +87 -70
  25. data/vendor/cmock/lib/cmock_header_parser.rb +29 -27
  26. data/vendor/cmock/src/cmock.h +1 -1
  27. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +46 -41
  28. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +46 -40
  29. data/vendor/cmock/vendor/c_exception/README.md +6 -4
  30. data/vendor/cmock/vendor/c_exception/docs/CException.md +2 -2
  31. data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
  32. data/vendor/cmock/vendor/c_exception/lib/meson.build +2 -2
  33. data/vendor/cmock/vendor/c_exception/meson.build +36 -2
  34. data/vendor/cmock/vendor/unity/README.md +77 -71
  35. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +1 -1
  36. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +107 -126
  37. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +149 -193
  38. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +236 -294
  39. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +112 -121
  40. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +82 -115
  41. data/vendor/cmock/vendor/unity/extras/fixture/readme.md +16 -19
  42. data/vendor/cmock/vendor/unity/extras/memory/readme.md +27 -34
  43. data/vendor/cmock/vendor/unity/src/unity.c +1 -1
  44. data/vendor/cmock/vendor/unity/src/unity.h +1 -1
  45. data/vendor/cmock/vendor/unity/src/unity_internals.h +21 -7
  46. data/vendor/unity/README.md +77 -71
  47. data/vendor/unity/auto/generate_test_runner.rb +1 -1
  48. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +107 -126
  49. data/vendor/unity/docs/UnityAssertionsReference.md +149 -193
  50. data/vendor/unity/docs/UnityConfigurationGuide.md +236 -294
  51. data/vendor/unity/docs/UnityGettingStartedGuide.md +112 -121
  52. data/vendor/unity/docs/UnityHelperScriptsGuide.md +82 -115
  53. data/vendor/unity/extras/fixture/readme.md +16 -19
  54. data/vendor/unity/extras/memory/readme.md +27 -34
  55. data/vendor/unity/src/unity.c +1 -1
  56. data/vendor/unity/src/unity.h +1 -1
  57. data/vendor/unity/src/unity_internals.h +21 -7
  58. metadata +14 -5
  59. data/plugins/gcov/config/defaults.yml +0 -55
@@ -72,8 +72,11 @@ by adding to the `:includes` array. For example:
72
72
  ```
73
73
  :module_generator:
74
74
  :includes:
75
- - defs.h
76
- - board.h
75
+ :tst:
76
+ - defs.h
77
+ - board.h
78
+ :src:
79
+ - board.h
77
80
  ```
78
81
 
79
82
  ### Boilerplates
@@ -90,6 +93,16 @@ put that corporate copyright notice (or maybe a copyleft notice, if that's your
90
93
  ***************************/
91
94
  ```
92
95
 
96
+ ### Test Defines
97
+
98
+ You can specify the "#ifdef TEST" at the top of the test files with a custom define.
99
+ This example will put a "#ifdef CEEDLING_TEST" at the top of the test files.
100
+
101
+ ```
102
+ :module_generator:
103
+ :test_define: CEEDLING_TEST
104
+ ```
105
+
93
106
  ### Naming Convention
94
107
 
95
108
  Finally, you can force a particular naming convention. Even if someone calls the generator
@@ -103,3 +116,4 @@ Your options are as follows:
103
116
  - `:snake` - snake_case_is_all_lower_and_uses_underscores
104
117
  - `:caps` - CAPS_FEELS_LIKE_YOU_ARE_SCREAMING
105
118
 
119
+
@@ -46,6 +46,7 @@ class ModuleGenerator < Plugin
46
46
  :naming => ((defined? MODULE_GENERATOR_NAMING ) ? MODULE_GENERATOR_NAMING : nil ),
47
47
  :update_svn => ((defined? MODULE_GENERATOR_UPDATE_SVN ) ? MODULE_GENERATOR_UPDATE_SVN : false ),
48
48
  :skeleton_path=> ((defined? MODULE_GENERATOR_SOURCE_ROOT ) ? MODULE_GENERATOR_SOURCE_ROOT.gsub('\\', '/').sub(/^\//, '').sub(/\/$/, '') : "src" ),
49
+ :test_define => ((defined? MODULE_GENERATOR_TEST_DEFINE ) ? MODULE_GENERATOR_TEST_DEFINE : "TEST" ),
49
50
  }
50
51
 
51
52
  # Read Boilerplate template file.
@@ -61,7 +61,7 @@ describe "Ceedling" do
61
61
 
62
62
  @output = `bundle exec ruby -S ceedling utils:gcov`
63
63
  expect(@output).to match(/For now, creating only an HtmlBasic report\./)
64
- expect(@output).to match(/Creating gcov results report\(s\) in 'build\/artifacts\/gcov'\.\.\. Done/)
64
+ expect(@output).to match(/Creating (?:a )?gcov (?:results)?(?:HTML)? report(?:\(s\))? in 'build\/artifacts\/gcov'\.\.\. Done/)
65
65
  expect(File.exists?('build/artifacts/gcov/GcovCoverageResults.html')).to eq true
66
66
 
67
67
  end
@@ -69,6 +69,7 @@ describe PreprocessinatorIncludesHandler do
69
69
  # mocks/stubs/expected calls
70
70
  expect(@configurator).to receive(:extension_header).and_return('.h')
71
71
  expect(@configurator).to receive(:extension_source).and_return('.c')
72
+ expect(@configurator).to receive(:project_config_hash).and_return( {:cmock_mock_prefix => 'mock_'})
72
73
  expect(@configurator).to receive(:tools_test_includes_preprocessor)
73
74
  expect(@configurator).to receive(:project_config_hash).and_return({ })
74
75
  expect(@file_path_utils).to receive(:form_temp_path).and_return("/_dummy_file.c")
@@ -106,6 +107,7 @@ describe PreprocessinatorIncludesHandler do
106
107
  # mocks/stubs/expected calls
107
108
  expect(@configurator).to receive(:extension_header).and_return('.h')
108
109
  expect(@configurator).to receive(:extension_source).and_return('.c')
110
+ expect(@configurator).to receive(:project_config_hash).and_return( {:cmock_mock_prefix => 'mock_'})
109
111
  expect(@configurator).to receive(:tools_test_includes_preprocessor)
110
112
  expect(@configurator).to receive(:project_config_hash).and_return({ })
111
113
  expect(@file_path_utils).to receive(:form_temp_path).and_return("/_dummy_file.c")
@@ -140,6 +142,7 @@ describe PreprocessinatorIncludesHandler do
140
142
  # mocks/stubs/expected calls
141
143
  expect(@configurator).to receive(:extension_header).and_return('.h')
142
144
  expect(@configurator).to receive(:extension_source).and_return('.c')
145
+ expect(@configurator).to receive(:project_config_hash).and_return( {:cmock_mock_prefix => 'mock_'})
143
146
  expect(@configurator).to receive(:tools_test_includes_preprocessor)
144
147
  expect(@configurator).to receive(:project_config_hash).and_return({ })
145
148
  expect(@file_path_utils).to receive(:form_temp_path).and_return("/_dummy_file.c")
@@ -166,6 +169,7 @@ describe PreprocessinatorIncludesHandler do
166
169
  # mocks/stubs/expected calls
167
170
  expect(@configurator).to receive(:extension_header).and_return('.h')
168
171
  expect(@configurator).to receive(:extension_source).and_return('.c')
172
+ expect(@configurator).to receive(:project_config_hash).and_return( {:cmock_mock_prefix => 'mock_'})
169
173
  expect(@configurator).to receive(:tools_test_includes_preprocessor)
170
174
  expect(@configurator).to receive(:project_config_hash).and_return({ })
171
175
  expect(@file_path_utils).to receive(:form_temp_path).and_return("/_dummy_file.c")
@@ -195,10 +199,43 @@ describe PreprocessinatorIncludesHandler do
195
199
  ]
196
200
  end
197
201
 
202
+ it 'should return the list of direct dependencies for the given source file' do
203
+ # create test state/variables
204
+ # mocks/stubs/expected calls
205
+ expect(@configurator).to receive(:extension_header).and_return('.h')
206
+ expect(@configurator).to receive(:extension_source).and_return('.c')
207
+ expect(@configurator).to receive(:project_config_hash).and_return( {:cmock_mock_prefix => 'mock_'})
208
+ expect(@configurator).to receive(:tools_test_includes_preprocessor)
209
+ expect(@configurator).to receive(:project_config_hash).and_return({ })
210
+ expect(@file_path_utils).to receive(:form_temp_path).and_return("/_dummy_file.c")
211
+ expect(@file_wrapper).to receive(:read).and_return("")
212
+ expect(@file_wrapper).to receive(:write)
213
+ expect(@tool_executor).to receive(:build_command_line).and_return({:line => "", :options => ""})
214
+ expect(@tool_executor).to receive(:exec).and_return({ :output => %q{
215
+ _DUMMY.o: Build/temp/_DUMMY.c \
216
+ source/new_some_header1_DUMMY.h \
217
+ source/some_header1__DUMMY.h \
218
+ @@@@new_some_header1_DUMMY.h \
219
+ @@@@some_header1__DUMMY.h \
220
+ }})
221
+ # execute method
222
+ results = subject.extract_includes_helper("/dummy_file_5.c", [], [], [])
223
+ # validate results
224
+ expect(results).to eq [
225
+ [ 'source/new_some_header1_DUMMY.h',
226
+ 'source/some_header1__DUMMY.h'],
227
+ [], []
228
+ ]
229
+ end
230
+ end
231
+
232
+ context 'extract_includes' do
198
233
  it 'should correctly filter auto link deep dependencies with mocks' do
199
234
  # create test state/variables
200
235
  # mocks/stubs/expected calls
201
- expect(@configurator).to receive(:project_config_hash).and_return(:collection_paths_include => [])
236
+ expect(@configurator).to receive(:project_config_hash).and_return({:cmock_mock_prefix => 'mock_',
237
+ :project_auto_link_deep_dependencies => true,
238
+ :collection_paths_include => []}).at_least(:once)
202
239
  expect(@configurator).to receive(:extension_header).and_return('.h').exactly(3).times
203
240
  expect(@configurator).to receive(:extension_source).and_return('.c').exactly(3).times
204
241
  expect(@configurator).to receive(:tools_test_includes_preprocessor).exactly(3).times
@@ -206,13 +243,6 @@ describe PreprocessinatorIncludesHandler do
206
243
  expect(@file_wrapper).to receive(:write).exactly(3).times
207
244
  expect(@file_finder).to receive(:find_compilation_input_file).and_return("assets\example_file.c")
208
245
  expect(@tool_executor).to receive(:build_command_line).and_return({:line => "", :options => ""}).exactly(3).times
209
- expect(@configurator).to receive(:project_config_hash).and_return(:project_auto_link_deep_dependencies => true).exactly(2).times
210
- expect(@configurator).to receive(:project_config_hash).and_return({:cmock_mock_prefix => 'mock_'})
211
- expect(@configurator).to receive(:project_config_hash).and_return(:project_auto_link_deep_dependencies => true).exactly(4).times
212
- expect(@configurator).to receive(:project_config_hash).and_return({:cmock_mock_prefix => 'mock_'})
213
- expect(@configurator).to receive(:project_config_hash).and_return(:project_auto_link_deep_dependencies => true).exactly(4).times
214
- expect(@configurator).to receive(:project_config_hash).and_return({:cmock_mock_prefix => 'mock_'})
215
- expect(@configurator).to receive(:project_config_hash).and_return(:project_auto_link_deep_dependencies => true).exactly(2).times
216
246
  expect(@file_path_utils).to receive(:form_temp_path).and_return("_test_DUMMY.c")
217
247
  expect(@file_path_utils).to receive(:form_temp_path).and_return("assets\_example_file.h")
218
248
  expect(@file_path_utils).to receive(:form_temp_path).and_return("assets\_example_file.c")
@@ -426,6 +426,25 @@ module CeedlingTestCases
426
426
  end
427
427
  end
428
428
 
429
+ def can_test_projects_with_both_mock_and_real_header
430
+ @c.with_context do
431
+ Dir.chdir @proj_name do
432
+ FileUtils.cp test_asset_path("example_file.h"), 'src/'
433
+ FileUtils.cp test_asset_path("example_file.c"), 'src/'
434
+ FileUtils.cp test_asset_path("example_file_call.h"), 'src/'
435
+ FileUtils.cp test_asset_path("example_file_call.c"), 'src/'
436
+ FileUtils.cp test_asset_path("test_example_file_with_mock.c"), 'test/'
437
+
438
+ output = `bundle exec ruby -S ceedling 2>&1`
439
+ expect($?.exitstatus).to match(0) # Since a test either pass or are ignored, we return success here
440
+ expect(output).to match(/TESTED:\s+\d/)
441
+ expect(output).to match(/PASSED:\s+\d/)
442
+ expect(output).to match(/FAILED:\s+\d/)
443
+ expect(output).to match(/IGNORED:\s+\d/)
444
+ end
445
+ end
446
+ end
447
+
429
448
  def uses_raw_output_report_plugin
430
449
  @c.with_context do
431
450
  Dir.chdir @proj_name do
@@ -37,6 +37,7 @@ describe "Ceedling" do
37
37
  it { can_test_projects_with_fail_alias }
38
38
  it { can_test_projects_with_fail_default }
39
39
  it { can_test_projects_with_compile_error }
40
+ it { can_test_projects_with_both_mock_and_real_header }
40
41
  it { uses_raw_output_report_plugin }
41
42
  it { can_use_the_module_plugin }
42
43
  it { can_use_the_module_plugin_path_extension }
@@ -41,8 +41,7 @@ class CMockFileWriter
41
41
 
42
42
  def update_file(dest, src)
43
43
  require 'fileutils'
44
- FileUtils.rm(dest) if File.exist?(dest)
45
- FileUtils.cp(src, dest)
46
- FileUtils.rm(src)
44
+ FileUtils.rm(dest, :force => true)
45
+ FileUtils.mv(src, dest)
47
46
  end
48
47
  end
@@ -20,9 +20,7 @@ class CMockGenerator
20
20
  @framework = @config.framework.to_s
21
21
  @fail_on_unexpected_calls = @config.fail_on_unexpected_calls
22
22
  @exclude_setjmp_h = @config.exclude_setjmp_h
23
-
24
23
  @subdir = @config.subdir
25
- @folder = nil
26
24
 
27
25
  @includes_h_pre_orig_header = (@config.includes || @config.includes_h_pre_orig_header || []).map { |h| h =~ /</ ? h : "\"#{h}\"" }
28
26
  @includes_h_post_orig_header = (@config.includes_h_post_orig_header || []).map { |h| h =~ /</ ? h : "\"#{h}\"" }
@@ -47,54 +45,70 @@ class CMockGenerator
47
45
  end
48
46
 
49
47
  def create_mock(module_name, parsed_stuff, module_ext = nil, folder = nil)
50
- @module_name = module_name
51
- @module_ext = module_ext || '.h'
52
- @mock_name = @prefix + @module_name + @suffix
53
- @clean_mock_name = TypeSanitizer.sanitize_c_identifier(@mock_name)
54
-
55
- @folder = if folder && @subdir
56
- File.join(@subdir, folder)
57
- elsif @subdir
58
- @subdir
59
- else
60
- folder
61
- end
62
- # adds a trailing slash to the folder output
63
- @folder = File.join(@folder, '') if @folder
48
+ # determine the name for our new mock
49
+ mock_name = @prefix + module_name + @suffix
50
+
51
+ # determine the folder our mock will reside
52
+ mock_folder = if folder && @subdir
53
+ File.join(@subdir, folder)
54
+ elsif @subdir
55
+ @subdir
56
+ else
57
+ folder
58
+ end
64
59
 
65
- create_mock_subdir
66
-
67
- create_mock_header_file(parsed_stuff)
68
- create_mock_source_file(parsed_stuff)
60
+ # adds a trailing slash to the folder output
61
+ mock_folder = File.join(mock_folder, '') if mock_folder
62
+
63
+ # create out mock project from incoming data
64
+ mock_project = {
65
+ :module_name => module_name,
66
+ :module_ext => (module_ext || '.h'),
67
+ :mock_name => mock_name,
68
+ :clean_name => TypeSanitizer.sanitize_c_identifier(mock_name),
69
+ :folder => mock_folder,
70
+ :parsed_stuff => parsed_stuff,
71
+ :skeleton => false
72
+ }
73
+
74
+ create_mock_subdir(mock_project)
75
+ create_mock_header_file(mock_project)
76
+ create_mock_source_file(mock_project)
69
77
  end
70
78
 
71
79
  def create_skeleton(module_name, parsed_stuff)
72
- @module_name = module_name
73
- create_skeleton_source_file(parsed_stuff)
80
+ mock_project = {
81
+ :module_name => module_name,
82
+ :module_ext => '.h',
83
+ :parsed_stuff => parsed_stuff,
84
+ :skeleton => true
85
+ }
86
+
87
+ create_skeleton_source_file(mock_project)
74
88
  end
75
89
 
76
90
  private if $ThisIsOnlyATest.nil? ##############################
77
91
 
78
- def create_mock_subdir
79
- @file_writer.create_subdir(@folder)
92
+ def create_mock_subdir(mock_project)
93
+ @file_writer.create_subdir(mock_project[:folder])
80
94
  end
81
95
 
82
96
  def create_using_statement(file, function)
83
97
  file << "using namespace #{function[:namespace].join('::')};\n" unless function[:namespace].empty?
84
98
  end
85
99
 
86
- def create_mock_header_file(parsed_stuff)
100
+ def create_mock_header_file(mock_project)
87
101
  if @include_inline == :include
88
- @file_writer.create_file(@module_name + (@module_ext || '.h'), @folder) do |file, _filename|
89
- file << parsed_stuff[:normalized_source]
102
+ @file_writer.create_file(mock_project[:module_name] + (mock_project[:module_ext]), mock_project[:folder]) do |file, _filename|
103
+ file << mock_project[:parsed_stuff][:normalized_source]
90
104
  end
91
105
  end
92
106
 
93
- @file_writer.create_file(@mock_name + (@module_ext || '.h'), @folder) do |file, filename|
94
- create_mock_header_header(file, filename)
95
- create_mock_header_service_call_declarations(file)
96
- create_typedefs(file, parsed_stuff[:typedefs])
97
- parsed_stuff[:functions].each do |function|
107
+ @file_writer.create_file(mock_project[:mock_name] + mock_project[:module_ext], mock_project[:folder]) do |file, filename|
108
+ create_mock_header_header(file, filename, mock_project)
109
+ create_mock_header_service_call_declarations(file, mock_project)
110
+ create_typedefs(file, mock_project)
111
+ mock_project[:parsed_stuff][:functions].each do |function|
98
112
  create_using_statement(file, function)
99
113
  file << @plugins.run(:mock_function_declarations, function)
100
114
  end
@@ -102,35 +116,37 @@ class CMockGenerator
102
116
  end
103
117
  end
104
118
 
105
- def create_mock_source_file(parsed_stuff)
106
- @file_writer.create_file(@mock_name + '.c', @folder) do |file, filename|
107
- create_source_header_section(file, filename, parsed_stuff[:functions])
108
- create_instance_structure(file, parsed_stuff[:functions])
119
+ def create_mock_source_file(mock_project)
120
+ @file_writer.create_file(mock_project[:mock_name] + '.c', mock_project[:folder]) do |file, filename|
121
+ create_source_header_section(file, filename, mock_project)
122
+ create_instance_structure(file, mock_project)
109
123
  create_extern_declarations(file)
110
- create_mock_verify_function(file, parsed_stuff[:functions])
111
- create_mock_init_function(file)
112
- create_mock_destroy_function(file, parsed_stuff[:functions])
113
- parsed_stuff[:functions].each do |function|
124
+ create_mock_verify_function(file, mock_project)
125
+ create_mock_init_function(file, mock_project)
126
+ create_mock_destroy_function(file, mock_project)
127
+ mock_project[:parsed_stuff][:functions].each do |function|
114
128
  create_mock_implementation(file, function)
115
129
  create_mock_interfaces(file, function)
116
130
  end
117
131
  end
118
132
  end
119
133
 
120
- def create_skeleton_source_file(parsed_stuff)
121
- filename = "#{@config.mock_path}/#{@subdir + '/' if @subdir}#{module_name}.c"
134
+ def create_skeleton_source_file(mock_project)
135
+ filename = "#{@config.mock_path}/#{@subdir + '/' if @subdir}#{mock_project[:module_name]}.c"
122
136
  existing = File.exist?(filename) ? File.read(filename) : ''
123
- @file_writer.append_file(@module_name + '.c', @subdir) do |file, fullname|
124
- create_source_header_section(file, fullname, []) if existing.empty?
125
- parsed_stuff[:functions].each do |function|
137
+ @file_writer.append_file(mock_project[:module_name] + '.c', @subdir) do |file, fullname|
138
+ blank_project = mock_project.clone
139
+ blank_project[:parsed_stuff] = { :functions => [] }
140
+ create_source_header_section(file, fullname, blank_project) if existing.empty?
141
+ mock_project[:parsed_stuff][:functions].each do |function|
126
142
  create_function_skeleton(file, function, existing)
127
143
  end
128
144
  end
129
145
  end
130
146
 
131
- def create_mock_header_header(file, _filename)
132
- define_name = @clean_mock_name.upcase
133
- orig_filename = (@folder || '') + @module_name + (@module_ext || '.h')
147
+ def create_mock_header_header(file, _filename, mock_project)
148
+ define_name = mock_project[:clean_name].upcase
149
+ orig_filename = (mock_project[:folder] || '') + mock_project[:module_name] + mock_project[:module_ext]
134
150
  file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n"
135
151
  file << "#ifndef _#{define_name}_H\n"
136
152
  file << "#define _#{define_name}_H\n\n"
@@ -155,16 +171,16 @@ class CMockGenerator
155
171
  file << "\n"
156
172
  end
157
173
 
158
- def create_typedefs(file, typedefs)
174
+ def create_typedefs(file, mock_project)
159
175
  file << "\n"
160
- typedefs.each { |typedef| file << "#{typedef}\n" }
176
+ mock_project[:parsed_stuff][:typedefs].each { |typedef| file << "#{typedef}\n" }
161
177
  file << "\n\n"
162
178
  end
163
179
 
164
- def create_mock_header_service_call_declarations(file)
165
- file << "void #{@clean_mock_name}_Init(void);\n"
166
- file << "void #{@clean_mock_name}_Destroy(void);\n"
167
- file << "void #{@clean_mock_name}_Verify(void);\n\n"
180
+ def create_mock_header_service_call_declarations(file, mock_project)
181
+ file << "void #{mock_project[:clean_name]}_Init(void);\n"
182
+ file << "void #{mock_project[:clean_name]}_Destroy(void);\n"
183
+ file << "void #{mock_project[:clean_name]}_Verify(void);\n\n"
168
184
  end
169
185
 
170
186
  def create_mock_header_footer(header)
@@ -178,9 +194,9 @@ class CMockGenerator
178
194
  header << "#endif\n"
179
195
  end
180
196
 
181
- def create_source_header_section(file, filename, functions)
182
- header_file = (@folder || '') + filename.gsub('.c', (@module_ext || '.h'))
183
- file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" unless functions.empty?
197
+ def create_source_header_section(file, filename, mock_project)
198
+ header_file = (mock_project[:folder] || '') + filename.gsub('.c', mock_project[:module_ext])
199
+ file << "/* AUTOGENERATED FILE. DO NOT EDIT. */\n" unless mock_project[:parsed_stuff][:functions].empty?
184
200
  file << "#include <string.h>\n"
185
201
  file << "#include <stdlib.h>\n"
186
202
  unless @exclude_setjmp_h
@@ -192,7 +208,7 @@ class CMockGenerator
192
208
  @includes_c_post_header.each { |inc| file << "#include #{inc}\n" }
193
209
  file << "\n"
194
210
  strs = []
195
- functions.each do |func|
211
+ mock_project[:parsed_stuff][:functions].each do |func|
196
212
  strs << func[:name]
197
213
  func[:args].each { |arg| strs << arg[:name] }
198
214
  end
@@ -202,14 +218,15 @@ class CMockGenerator
202
218
  file << "\n"
203
219
  end
204
220
 
205
- def create_instance_structure(file, functions)
221
+ def create_instance_structure(file, mock_project)
222
+ functions = mock_project[:parsed_stuff][:functions]
206
223
  functions.each do |function|
207
224
  file << "typedef struct _CMOCK_#{function[:name]}_CALL_INSTANCE\n{\n"
208
225
  file << " UNITY_LINE_TYPE LineNumber;\n"
209
226
  file << @plugins.run(:instance_typedefs, function)
210
227
  file << "\n} CMOCK_#{function[:name]}_CALL_INSTANCE;\n\n"
211
228
  end
212
- file << "static struct #{@clean_mock_name}Instance\n{\n"
229
+ file << "static struct #{mock_project[:clean_name]}Instance\n{\n"
213
230
  if functions.empty?
214
231
  file << " unsigned char placeHolder;\n"
215
232
  end
@@ -231,9 +248,9 @@ class CMockGenerator
231
248
  file << "\n"
232
249
  end
233
250
 
234
- def create_mock_verify_function(file, functions)
235
- file << "void #{@clean_mock_name}_Verify(void)\n{\n"
236
- verifications = functions.collect do |function|
251
+ def create_mock_verify_function(file, mock_project)
252
+ file << "void #{mock_project[:clean_name]}_Verify(void)\n{\n"
253
+ verifications = mock_project[:parsed_stuff][:functions].collect do |function|
237
254
  v = @plugins.run(:mock_verify, function)
238
255
  v.empty? ? v : [" call_instance = Mock.#{function[:name]}_CallInstance;\n", v]
239
256
  end.join
@@ -245,20 +262,20 @@ class CMockGenerator
245
262
  file << "}\n\n"
246
263
  end
247
264
 
248
- def create_mock_init_function(file)
249
- file << "void #{@clean_mock_name}_Init(void)\n{\n"
250
- file << " #{@clean_mock_name}_Destroy();\n"
265
+ def create_mock_init_function(file, mock_project)
266
+ file << "void #{mock_project[:clean_name]}_Init(void)\n{\n"
267
+ file << " #{mock_project[:clean_name]}_Destroy();\n"
251
268
  file << "}\n\n"
252
269
  end
253
270
 
254
- def create_mock_destroy_function(file, functions)
255
- file << "void #{@clean_mock_name}_Destroy(void)\n{\n"
271
+ def create_mock_destroy_function(file, mock_project)
272
+ file << "void #{mock_project[:clean_name]}_Destroy(void)\n{\n"
256
273
  file << " CMock_Guts_MemFreeAll();\n"
257
274
  file << " memset(&Mock, 0, sizeof(Mock));\n"
258
- file << functions.collect { |function| @plugins.run(:mock_destroy, function) }.join
275
+ file << mock_project[:parsed_stuff][:functions].collect { |function| @plugins.run(:mock_destroy, function) }.join
259
276
 
260
277
  unless @fail_on_unexpected_calls
261
- file << functions.collect { |function| @plugins.run(:mock_ignore, function) }.join
278
+ file << mock_project[:parsed_stuff][:functions].collect { |function| @plugins.run(:mock_ignore, function) }.join
262
279
  end
263
280
 
264
281
  if @ordered