ceedling 0.17.0 → 0.18.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. checksums.yaml +4 -4
  2. data/ceedling.gemspec +1 -1
  3. data/lib/ceedling/version.rb +2 -2
  4. data/lib/ceedling/version.rb.erb +1 -2
  5. data/test_graveyard/unit/busted/generator_test_runner_test.rb +2 -5
  6. data/vendor/cmock/Gemfile +1 -3
  7. data/vendor/cmock/Rakefile +10 -17
  8. data/vendor/cmock/docs/license.txt +18 -30
  9. data/vendor/cmock/examples/gcc.yml +2 -2
  10. data/vendor/cmock/examples/iar_v4.yml +3 -3
  11. data/vendor/cmock/examples/iar_v5.yml +3 -3
  12. data/vendor/cmock/examples/rakefile_helper.rb +35 -35
  13. data/vendor/cmock/lib/cmock_generator.rb +17 -5
  14. data/vendor/cmock/lib/cmock_generator_plugin_array.rb +9 -3
  15. data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +1 -1
  16. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +1 -1
  17. data/vendor/cmock/lib/cmock_header_parser.rb +7 -3
  18. data/vendor/cmock/release/version.info +1 -1
  19. data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +1 -2
  20. data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -1
  21. data/vendor/cmock/test/system/systest_generator.rb +6 -2
  22. data/vendor/cmock/test/system/test_compilation/const.h +3 -1
  23. data/vendor/cmock/test/test_helper.rb +38 -40
  24. data/vendor/cmock/test/unit/cmock_config_test.rb +26 -29
  25. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +8 -11
  26. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +82 -80
  27. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +62 -43
  28. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +44 -45
  29. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +30 -31
  30. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +15 -16
  31. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_test.rb +76 -77
  32. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +19 -19
  33. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +17 -18
  34. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +17 -17
  35. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +74 -65
  36. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +103 -76
  37. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +46 -36
  38. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +85 -85
  39. data/vendor/unity/auto/generate_test_runner.rb +4 -3
  40. data/vendor/unity/auto/type_sanitizer.rb +8 -0
  41. data/vendor/unity/auto/unity_test_summary.py +135 -0
  42. data/vendor/unity/examples/example_1/makefile +16 -0
  43. data/vendor/unity/examples/example_1/src/ProductionCode2.c +2 -0
  44. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +0 -13
  45. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +0 -13
  46. data/vendor/unity/examples/example_2/makefile +20 -1
  47. data/vendor/unity/examples/example_2/src/ProductionCode2.c +2 -0
  48. data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +2 -2
  49. data/vendor/unity/examples/example_3/makefile +16 -0
  50. data/vendor/unity/examples/example_3/src/ProductionCode2.c +2 -0
  51. data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode2_Runner.c +0 -13
  52. data/vendor/unity/examples/example_3/test/no_ruby/TestProductionCode_Runner.c +0 -13
  53. data/vendor/unity/extras/fixture/rakefile.rb +14 -3
  54. data/vendor/unity/extras/fixture/src/unity_fixture.c +21 -11
  55. data/vendor/unity/extras/fixture/src/unity_fixture.h +8 -4
  56. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -1
  57. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +5 -0
  58. data/vendor/unity/extras/fixture/test/main/AllTests.c +2 -2
  59. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +8 -8
  60. data/vendor/unity/extras/fixture/test/unity_output_Spy.c +2 -2
  61. data/vendor/unity/extras/fixture/test/unity_output_Spy.h +2 -2
  62. data/vendor/unity/release/version.info +1 -1
  63. data/vendor/unity/src/unity.c +26 -19
  64. data/vendor/unity/src/unity_internals.h +9 -12
  65. data/vendor/unity/test/targets/gcc_auto_stdint.yml +13 -0
  66. metadata +4 -5
  67. data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +0 -45
  68. data/vendor/cmock/test/spec/cmock_generator_plugin_array_spec.rb +0 -52
  69. data/vendor/cmock/test/spec/spec_helper.rb +0 -12
@@ -2,27 +2,40 @@
2
2
  # CMock Project - Automatic Mock Generation for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
8
8
  require 'cmock_plugin_manager'
9
+ require 'cmock_generator_plugin_expect'
10
+ require 'cmock_generator_plugin_ignore'
11
+ require 'cmock_generator_plugin_cexception'
12
+
13
+ describe CMockPluginManager, "Verify CMockPluginManager Module" do
9
14
 
10
- class CMockPluginManagerTest < Test::Unit::TestCase
11
- def setup
12
- create_mocks :config, :utils, :pluginA, :pluginB
13
- @config.stubs!(:respond_to?).returns(true)
14
- @config.stubs!(:when_ptr).returns(:compare_data)
15
- @config.stubs!(:enforce_strict_ordering).returns(false)
16
- @config.stubs!(:ignore).returns(:args_and_calls)
15
+ before do
16
+ create_mocks :utils, :pluginA, :pluginB
17
+ @config = create_stub(
18
+ :respond_to => true,
19
+ :when_ptr => :compare_data,
20
+ :enforce_strict_ordering => false,
21
+ :ignore => :args_and_calls
22
+ )
23
+
24
+ #if (RUBY_VERSION.split('.')[0].to_i >= 2)
25
+ # @config.define_singleton_method( :plugins ){ @plugins || [] }
26
+ # @config.define_singleton_method( :plugins= ){ |val| @plugins = val }
27
+ #else
28
+ eval "class << @config\ndef plugins\n@plugins||[]\nend\ndef plugins=(val)\n@plugins=val\nend\nend\n"
29
+ #end
17
30
  end
18
31
 
19
- def teardown
32
+ after do
20
33
  end
21
-
22
- should "return all plugins by default" do
23
- @config.expect.plugins.returns(['cexception','ignore'])
24
- @utils.expect.helpers.returns({})
25
-
34
+
35
+ it "return all plugins by default" do
36
+ @config.plugins = ['cexception','ignore']
37
+ @utils.expect :helpers, {}
38
+
26
39
  @cmock_plugins = CMockPluginManager.new(@config, @utils)
27
40
 
28
41
  test_plugins = @cmock_plugins.plugins
@@ -36,13 +49,12 @@ class CMockPluginManagerTest < Test::Unit::TestCase
36
49
  assert_equal(true, contained[:ignore])
37
50
  assert_equal(true, contained[:cexception])
38
51
  end
39
-
40
- should "return restricted plugins based on config" do
41
- @config.expect.plugins.returns([])
42
- @utils.expect.helpers.returns({})
43
-
52
+
53
+ it "return restricted plugins based on config" do
54
+ @utils.expect :helpers, {}
55
+
44
56
  @cmock_plugins = CMockPluginManager.new(@config, @utils)
45
-
57
+
46
58
  test_plugins = @cmock_plugins.plugins
47
59
  contained = { :expect => false, :ignore => false, :cexception => false }
48
60
  test_plugins.each do |plugin|
@@ -54,30 +66,28 @@ class CMockPluginManagerTest < Test::Unit::TestCase
54
66
  assert_equal(false,contained[:ignore])
55
67
  assert_equal(false,contained[:cexception])
56
68
  end
57
-
58
- should "run a desired method over each plugin requested and return the results" do
59
- @config.expect.plugins.returns([])
60
- @utils.expect.helpers.returns({})
69
+
70
+ it "run a desired method over each plugin requested and return the results" do
71
+ @utils.expect :helpers, {}
61
72
  @cmock_plugins = CMockPluginManager.new(@config, @utils)
62
-
73
+
74
+ @pluginA = create_stub(:test_method => ["This Is An Awesome Test-"])
75
+ @pluginB = create_stub(:test_method => ["And This is Part 2-","Of An Awesome Test"])
63
76
  @cmock_plugins.plugins = [@pluginA, @pluginB]
64
- @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"])
65
- @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"])
66
-
77
+
67
78
  expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test"
68
79
  output = @cmock_plugins.run(:test_method)
69
80
  assert_equal(expected, output)
70
81
  end
71
-
72
- should "run a desired method and arg list over each plugin requested and return the results" do
73
- @config.expect.plugins.returns([])
74
- @utils.expect.helpers.returns({})
82
+
83
+ it "run a desired method and arg list over each plugin requested and return the results" do
84
+ @utils.expect :helpers, {}
75
85
  @cmock_plugins = CMockPluginManager.new(@config, @utils)
76
-
86
+
87
+ @pluginA = create_stub(:test_method => ["This Is An Awesome Test-"])
88
+ @pluginB = create_stub(:test_method => ["And This is Part 2-","Of An Awesome Test"])
77
89
  @cmock_plugins.plugins = [@pluginA, @pluginB]
78
- @pluginA.stubs!(:test_method).returns(["This Is An Awesome Test-"])
79
- @pluginB.stubs!(:test_method).returns(["And This is Part 2-","Of An Awesome Test"])
80
-
90
+
81
91
  expected = "This Is An Awesome Test-And This is Part 2-Of An Awesome Test"
82
92
  output = @cmock_plugins.run(:test_method, "chickenpotpie")
83
93
  assert_equal(expected, output)
@@ -2,50 +2,50 @@
2
2
  # CMock Project - Automatic Mock Generation for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  require File.expand_path(File.dirname(__FILE__)) + "/../test_helper"
8
8
  require 'cmock_unityhelper_parser'
9
9
 
10
- class CMockUnityHelperParserTest < Test::Unit::TestCase
10
+ describe CMockUnityHelperParser, "Verify CMockUnityHelperParser Module" do
11
11
 
12
- def setup
12
+ before do
13
13
  create_mocks :config
14
14
  end
15
15
 
16
- def teardown
16
+ after do
17
17
  end
18
-
19
- should "ignore lines that are commented out" do
20
- source =
18
+
19
+ it "ignore lines that are commented out" do
20
+ source =
21
21
  " abcd;\n" +
22
22
  "// #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" +
23
23
  "or maybe // #define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n\n"
24
- @config.expects.plugins.returns([]) #not :array
25
- @config.expects.treat_as.returns({})
26
- @config.expects.load_unity_helper.returns(source)
24
+ @config.expect :plugins, [] #not :array
25
+ @config.expect :treat_as, {}
26
+ @config.expect :load_unity_helper, source
27
27
  @parser = CMockUnityHelperParser.new(@config)
28
28
  expected = {}
29
-
29
+
30
30
  assert_equal(expected, @parser.c_types)
31
31
  end
32
-
33
- should "ignore stuff in block comments" do
34
- source =
32
+
33
+ it "ignore stuff in block comments" do
34
+ source =
35
35
  " abcd; /*\n" +
36
36
  "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n" +
37
37
  "#define UNITY_TEST_ASSERT_EQUAL_CHICKENS(a,b,line,msg) {...};\n */\n"
38
- @config.expects.plugins.returns([]) #not :array
39
- @config.expects.treat_as.returns({})
40
- @config.expect.load_unity_helper.returns(source)
38
+ @config.expect :plugins, [] #not :array
39
+ @config.expect :treat_as, {}
40
+ @config.expect :load_unity_helper, source
41
41
  @parser = CMockUnityHelperParser.new(@config)
42
42
  expected = {}
43
-
43
+
44
44
  assert_equal(expected, @parser.c_types)
45
45
  end
46
-
47
- should "notice equal helpers in the proper form and ignore others" do
48
- source =
46
+
47
+ it "notice equal helpers in the proper form and ignore others" do
48
+ source =
49
49
  "abcd;\n" +
50
50
  "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_T(a,b,line,msg) {...};\n" +
51
51
  "abcd;\n" +
@@ -53,20 +53,20 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
53
53
  "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL(a,b,c,d) {...};\n" +
54
54
  "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits(a,b,c,d) {...};\n" +
55
55
  "abcd;\n"
56
- @config.expects.plugins.returns([]) #not :array
57
- @config.expects.treat_as.returns({})
58
- @config.expect.load_unity_helper.returns(source)
56
+ @config.expect :plugins, [] #not :array
57
+ @config.expect :treat_as, {}
58
+ @config.expect :load_unity_helper, source
59
59
  @parser = CMockUnityHelperParser.new(@config)
60
60
  expected = {
61
61
  'TURKEYS_T' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_T",
62
62
  'unsigned_funky_rabbits' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits"
63
63
  }
64
-
64
+
65
65
  assert_equal(expected, @parser.c_types)
66
66
  end
67
67
 
68
- should "notice equal helpers that contain arrays" do
69
- source =
68
+ it "notice equal helpers that contain arrays" do
69
+ source =
70
70
  "abcd;\n" +
71
71
  "#define UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY(a,b,c,d,e) {...};\n" +
72
72
  "abcd;\n" +
@@ -74,19 +74,19 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
74
74
  "#define UNITY_TEST_ASSERT_WRONG_NAME_EQUAL_ARRAY(a,b,c,d,e) {...};\n" +
75
75
  "#define UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY(a,b,c,d,e) {...};\n" +
76
76
  "abcd;\n"
77
- @config.expects.plugins.returns([]) #not :array
78
- @config.expects.treat_as.returns({})
79
- @config.expect.load_unity_helper.returns(source)
77
+ @config.expect :plugins, [] #not :array
78
+ @config.expect :treat_as, {}
79
+ @config.expect :load_unity_helper, source
80
80
  @parser = CMockUnityHelperParser.new(@config)
81
81
  expected = {
82
82
  'TURKEYS*' => "UNITY_TEST_ASSERT_EQUAL_TURKEYS_ARRAY",
83
83
  'unsigned_funky_rabbits*' => "UNITY_TEST_ASSERT_EQUAL_unsigned_funky_rabbits_ARRAY"
84
84
  }
85
-
85
+
86
86
  assert_equal(expected, @parser.c_types)
87
87
  end
88
88
 
89
- should "pull in the standard set of helpers and add them to my list" do
89
+ it "pull in the standard set of helpers and add them to my list" do
90
90
  pairs = {
91
91
  "UINT" => "HEX32",
92
92
  "unsigned long" => "HEX64",
@@ -97,15 +97,15 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
97
97
  "UINT*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY",
98
98
  "unsigned_long*"=> "UNITY_TEST_ASSERT_EQUAL_HEX64_ARRAY",
99
99
  }
100
- @config.expects.plugins.returns([]) #not :array
101
- @config.expects.treat_as.returns(pairs)
102
- @config.expect.load_unity_helper.returns(nil)
100
+ @config.expect :plugins, [] #not :array
101
+ @config.expect :treat_as, pairs
102
+ @config.expect :load_unity_helper, nil
103
103
  @parser = CMockUnityHelperParser.new(@config)
104
-
104
+
105
105
  assert_equal(expected, @parser.c_types)
106
106
  end
107
-
108
- should "pull in the user specified set of helpers and add them to my list" do
107
+
108
+ it "pull in the user specified set of helpers and add them to my list" do
109
109
  pairs = {
110
110
  "char*" => "STRING",
111
111
  "unsigned int" => "HEX32",
@@ -116,18 +116,18 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
116
116
  "char**" => "UNITY_TEST_ASSERT_EQUAL_STRING_ARRAY",
117
117
  "unsigned_int*" => "UNITY_TEST_ASSERT_EQUAL_HEX32_ARRAY",
118
118
  }
119
- @config.expects.plugins.returns([]) #not :array
120
- @config.expects.treat_as.returns(pairs)
121
- @config.expect.load_unity_helper.returns(nil)
119
+ @config.expect :plugins, [] #not :array
120
+ @config.expect :treat_as, pairs
121
+ @config.expect :load_unity_helper, nil
122
122
  @parser = CMockUnityHelperParser.new(@config)
123
-
123
+
124
124
  assert_equal(expected, @parser.c_types)
125
125
  end
126
-
127
- should "be able to fetch helpers on my list" do
128
- @config.expects.plugins.returns([]) #not :array
129
- @config.expects.treat_as.returns({})
130
- @config.expect.load_unity_helper.returns("")
126
+
127
+ it "be able to fetch helpers on my list" do
128
+ @config.expect :plugins, [] #not :array
129
+ @config.expect :treat_as, {}
130
+ @config.expect :load_unity_helper, ""
131
131
  @parser = CMockUnityHelperParser.new(@config)
132
132
  @parser.c_types = {
133
133
  'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
@@ -135,89 +135,89 @@ class CMockUnityHelperParserTest < Test::Unit::TestCase
135
135
  'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
136
136
  'LONG_LONG' => "UNITY_TEST_ASSERT_EQUAL_LONG_LONG"
137
137
  }
138
-
138
+
139
139
  [["UINT8","UINT8"],
140
140
  ["UINT16*","UINT16_ARRAY"],
141
141
  ["const SPINACH","SPINACH"],
142
142
  ["LONG LONG","LONG_LONG"] ].each do |ctype, exptype|
143
- assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype))
143
+ assert_equal(["UNITY_TEST_ASSERT_EQUAL_#{exptype}",''], @parser.get_helper(ctype))
144
144
  end
145
145
  end
146
146
 
147
- should "return memory comparison when asked to fetch helper of types not on my list" do
148
- @config.expects.plugins.returns([]) #not :array
149
- @config.expects.treat_as.returns({})
150
- @config.expects.load_unity_helper.returns("")
147
+ it "return memory comparison when asked to fetch helper of types not on my list" do
148
+ @config.expect :plugins, [] #not :array
149
+ @config.expect :treat_as, {}
150
+ @config.expect :load_unity_helper, ""
151
151
  @parser = CMockUnityHelperParser.new(@config)
152
152
  @parser.c_types = {
153
153
  'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
154
154
  'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",
155
155
  'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
156
156
  }
157
-
157
+
158
158
  ["UINT32","SPINACH_T","SALAD","PINEAPPLE"].each do |ctype|
159
- @config.expect.memcmp_if_unknown.returns(true)
160
- assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype))
159
+ @config.expect :memcmp_if_unknown, true
160
+ assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY",'&'], @parser.get_helper(ctype))
161
161
  end
162
162
  end
163
163
 
164
- should "return memory array comparison when asked to fetch helper of types not on my list" do
165
- @config.expects.plugins.returns([:array])
166
- @config.expects.treat_as.returns({})
167
- @config.expects.load_unity_helper.returns("")
164
+ it "return memory array comparison when asked to fetch helper of types not on my list" do
165
+ @config.expect :plugins, [:array]
166
+ @config.expect :treat_as, {}
167
+ @config.expect :load_unity_helper, ""
168
168
  @parser = CMockUnityHelperParser.new(@config)
169
169
  @parser.c_types = {
170
170
  'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
171
171
  'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",
172
172
  'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
173
173
  }
174
-
174
+
175
175
  ["UINT32*","SPINACH_T*"].each do |ctype|
176
- @config.expect.memcmp_if_unknown.returns(true)
177
- assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype))
176
+ @config.expect :memcmp_if_unknown, true
177
+ assert_equal(["UNITY_TEST_ASSERT_EQUAL_MEMORY_ARRAY",''], @parser.get_helper(ctype))
178
178
  end
179
179
  end
180
-
181
- should "return the array handler if we cannot find the normal handler" do
182
- @config.expects.plugins.returns([]) #not :array
183
- @config.expects.treat_as.returns({})
184
- @config.expect.load_unity_helper.returns("")
180
+
181
+ it "return the array handler if we cannot find the normal handler" do
182
+ @config.expect :plugins, [] #not :array
183
+ @config.expect :treat_as, {}
184
+ @config.expect :load_unity_helper, ""
185
185
  @parser = CMockUnityHelperParser.new(@config)
186
186
  @parser.c_types = {
187
187
  'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
188
188
  'UINT16*' => "UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",
189
189
  'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
190
190
  }
191
-
192
- assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16"))
191
+
192
+ assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT16_ARRAY",'&'], @parser.get_helper("UINT16"))
193
193
  end
194
-
195
- should "return the normal handler if we cannot find the array handler" do
196
- @config.expects.plugins.returns([]) #not :array
197
- @config.expects.treat_as.returns({})
198
- @config.expect.load_unity_helper.returns("")
194
+
195
+ it "return the normal handler if we cannot find the array handler" do
196
+ @config.expect :plugins, [] #not :array
197
+ @config.expect :treat_as, {}
198
+ @config.expect :load_unity_helper, ""
199
199
  @parser = CMockUnityHelperParser.new(@config)
200
200
  @parser.c_types = {
201
201
  'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
202
202
  'UINT16' => "UNITY_TEST_ASSERT_EQUAL_UINT16",
203
203
  'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
204
204
  }
205
-
206
- assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*"))
205
+
206
+ assert_equal(["UNITY_TEST_ASSERT_EQUAL_UINT8",'*'], @parser.get_helper("UINT8*"))
207
207
  end
208
-
209
- should "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do
210
- @config.expects.plugins.returns([]) #not :array
211
- @config.expects.treat_as.returns({})
212
- @config.expect.load_unity_helper.returns("")
213
- @config.expect.memcmp_if_unknown.returns(false)
208
+
209
+ it "raise error when asked to fetch helper of type not on my list and not allowed to mem check" do
210
+ @config.expect :plugins, [] #not :array
211
+ @config.expect :treat_as, {}
212
+ @config.expect :load_unity_helper, ""
213
+ @config.expect :memcmp_if_unknown, false
214
214
  @parser = CMockUnityHelperParser.new(@config)
215
215
  @parser.c_types = {
216
216
  'UINT8' => "UNITY_TEST_ASSERT_EQUAL_UINT8",
217
217
  'UINT32*' => "UNITY_TEST_ASSERT_EQUAL_UINT32_ARRAY",
218
218
  'SPINACH' => "UNITY_TEST_ASSERT_EQUAL_SPINACH",
219
219
  }
220
-
221
- assert_raise(RuntimeError) { @parser.get_helper("UINT16") }
220
+
221
+ assert_raises (RuntimeError) { @parser.get_helper("UINT16") }
222
222
  end
223
223
  end
@@ -17,6 +17,7 @@ class UnityTestRunnerGenerator
17
17
  when Hash then @options.merge!(options)
18
18
  else raise "If you specify arguments, it should be a filename or a hash of options"
19
19
  end
20
+ require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
20
21
  end
21
22
 
22
23
  def self.default_options
@@ -190,7 +191,7 @@ class UnityTestRunnerGenerator
190
191
  output.puts(" GlobalOrderError = NULL;")
191
192
  end
192
193
  mocks.each do |mock|
193
- mock_clean = mock.gsub(/(?:-|\s+)/, "_")
194
+ mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
194
195
  output.puts(" #{mock_clean}_Init();")
195
196
  end
196
197
  output.puts("}\n")
@@ -198,7 +199,7 @@ class UnityTestRunnerGenerator
198
199
  output.puts("static void CMock_Verify(void)")
199
200
  output.puts("{")
200
201
  mocks.each do |mock|
201
- mock_clean = mock.gsub(/(?:-|\s+)/, "_")
202
+ mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
202
203
  output.puts(" #{mock_clean}_Verify();")
203
204
  end
204
205
  output.puts("}\n")
@@ -206,7 +207,7 @@ class UnityTestRunnerGenerator
206
207
  output.puts("static void CMock_Destroy(void)")
207
208
  output.puts("{")
208
209
  mocks.each do |mock|
209
- mock_clean = mock.gsub(/(?:-|\s+)/, "_")
210
+ mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
210
211
  output.puts(" #{mock_clean}_Destroy();")
211
212
  end
212
213
  output.puts("}\n")