ceedling 0.24.0 → 0.25.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.
- checksums.yaml +4 -4
- data/bin/ceedling +6 -1
- data/docs/CeedlingPacket.md +9 -0
- data/lib/ceedling/generator.rb +2 -2
- data/lib/ceedling/generator_test_runner.rb +32 -1
- data/lib/ceedling/rakefile.rb +1 -1
- data/lib/ceedling/system_wrapper.rb +13 -10
- data/lib/ceedling/tool_executor.rb +2 -2
- data/lib/ceedling/version.rb +1 -1
- data/plugins/command_hooks/README.md +52 -0
- data/plugins/command_hooks/lib/command_hooks.rb +71 -0
- data/plugins/module_generator/lib/module_generator.rb +10 -4
- data/plugins/module_generator/module_generator.rake +2 -2
- data/spec/spec_system_helper.rb +16 -11
- data/spec/system/deployment_spec.rb +2 -2
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +77 -34
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +1 -1
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +3 -3
- data/vendor/c_exception/vendor/unity/src/unity.c +105 -105
- data/vendor/c_exception/vendor/unity/src/unity.h +8 -8
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +139 -139
- data/vendor/c_exception/vendor/unity/test/tests/testunity.c +141 -142
- data/vendor/cmock/lib/cmock_generator.rb +2 -1
- data/vendor/cmock/test/c/TestCMockC.c +1 -1
- data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +13 -13
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +4 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +77 -34
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +3 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +105 -105
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +8 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +139 -139
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +141 -142
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +77 -34
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +1 -1
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +3 -3
- data/vendor/cmock/vendor/unity/src/unity.c +105 -105
- data/vendor/cmock/vendor/unity/src/unity.h +8 -8
- data/vendor/cmock/vendor/unity/src/unity_internals.h +139 -139
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +141 -142
- data/vendor/unity/auto/generate_module.rb +77 -34
- data/vendor/unity/extras/fixture/src/unity_fixture.c +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +3 -3
- data/vendor/unity/src/unity.c +105 -105
- data/vendor/unity/src/unity.h +8 -8
- data/vendor/unity/src/unity_internals.h +139 -139
- data/vendor/unity/test/tests/testunity.c +141 -142
- metadata +4 -2
@@ -10,6 +10,7 @@
|
|
10
10
|
|
11
11
|
require 'rubygems'
|
12
12
|
require 'fileutils'
|
13
|
+
require 'pathname'
|
13
14
|
|
14
15
|
#TEMPLATE_TST
|
15
16
|
TEMPLATE_TST ||= %q[#include "unity.h"
|
@@ -35,7 +36,8 @@ TEMPLATE_SRC ||= %q[%2$s#include "%1$s.h"
|
|
35
36
|
|
36
37
|
#TEMPLATE_INC
|
37
38
|
TEMPLATE_INC ||= %q[#ifndef _%3$s_H
|
38
|
-
#define _%3$s_H
|
39
|
+
#define _%3$s_H
|
40
|
+
%2$s
|
39
41
|
|
40
42
|
#endif // _%3$s_H
|
41
43
|
]
|
@@ -65,19 +67,20 @@ class UnityModuleGenerator
|
|
65
67
|
|
66
68
|
#Built in patterns
|
67
69
|
@patterns = { 'src' => {'' => { :inc => [] } },
|
68
|
-
'
|
70
|
+
'test'=> {'' => { :inc => [] } },
|
71
|
+
'dh' => {'Driver' => { :inc => [create_filename('%1$s','Hardware.h')] },
|
69
72
|
'Hardware' => { :inc => [] }
|
70
73
|
},
|
71
|
-
'dih' => {'Driver' => { :inc => ['%1$
|
72
|
-
'Interrupt'=> { :inc => ['%1$
|
74
|
+
'dih' => {'Driver' => { :inc => [create_filename('%1$s','Hardware.h'), create_filename('%1$s','Interrupt.h')] },
|
75
|
+
'Interrupt'=> { :inc => [create_filename('%1$s','Hardware.h')] },
|
73
76
|
'Hardware' => { :inc => [] }
|
74
77
|
},
|
75
78
|
'mch' => {'Model' => { :inc => [] },
|
76
|
-
'Conductor'=> { :inc => ['%1$
|
79
|
+
'Conductor'=> { :inc => [create_filename('%1$s','Model.h'), create_filename('%1$s','Hardware.h')] },
|
77
80
|
'Hardware' => { :inc => [] }
|
78
81
|
},
|
79
82
|
'mvp' => {'Model' => { :inc => [] },
|
80
|
-
'Presenter'=> { :inc => ['%1$
|
83
|
+
'Presenter'=> { :inc => [create_filename('%1$s','Model.h'), create_filename('%1$s','View.h')] },
|
81
84
|
'View' => { :inc => [] }
|
82
85
|
}
|
83
86
|
}
|
@@ -96,6 +99,7 @@ class UnityModuleGenerator
|
|
96
99
|
:update_svn => false,
|
97
100
|
:boilerplates => {},
|
98
101
|
:test_prefix => 'Test',
|
102
|
+
:mock_prefix => 'Mock',
|
99
103
|
}
|
100
104
|
end
|
101
105
|
|
@@ -113,30 +117,42 @@ class UnityModuleGenerator
|
|
113
117
|
|
114
118
|
############################
|
115
119
|
def files_to_operate_on(module_name, pattern=nil)
|
120
|
+
#strip any leading path information from the module name and save for later
|
121
|
+
subfolder = File.dirname(module_name)
|
122
|
+
module_name = File.basename(module_name)
|
123
|
+
|
116
124
|
#create triad definition
|
117
125
|
prefix = @options[:test_prefix] || 'Test'
|
118
|
-
triad = [ { :ext => '.c', :path => @options[:path_src],
|
119
|
-
{ :ext => '.h', :path => @options[:path_inc],
|
120
|
-
{ :ext => '.c', :path => @options[:path_tst]
|
126
|
+
triad = [ { :ext => '.c', :path => @options[:path_src], :prefix => "", :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @options[:boilerplates][:src] },
|
127
|
+
{ :ext => '.h', :path => @options[:path_inc], :prefix => "", :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @options[:boilerplates][:inc] },
|
128
|
+
{ :ext => '.c', :path => @options[:path_tst], :prefix => prefix, :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @options[:boilerplates][:tst] },
|
121
129
|
]
|
122
130
|
|
123
131
|
#prepare the pattern for use
|
124
|
-
|
132
|
+
pattern = (pattern || @options[:pattern] || 'src').downcase
|
133
|
+
patterns = @patterns[pattern]
|
125
134
|
raise "ERROR: The design pattern '#{pattern}' specified isn't one that I recognize!" if patterns.nil?
|
126
135
|
|
136
|
+
#single file patterns (currently just 'test') can reject the other parts of the triad
|
137
|
+
if (pattern == 'test')
|
138
|
+
triad.reject!{|v| v[:inc] != :tst }
|
139
|
+
end
|
140
|
+
|
127
141
|
# Assemble the path/names of the files we need to work with.
|
128
142
|
files = []
|
129
|
-
triad.each do |
|
143
|
+
triad.each do |cfg|
|
130
144
|
patterns.each_pair do |pattern_file, pattern_traits|
|
145
|
+
submodule_name = create_filename(module_name, pattern_file)
|
146
|
+
filename = cfg[:prefix] + submodule_name + cfg[:ext]
|
131
147
|
files << {
|
132
|
-
:path => "#{
|
133
|
-
:name =>
|
134
|
-
:template =>
|
135
|
-
:boilerplate =>
|
136
|
-
:includes => case(
|
137
|
-
when :src then @options[:includes][:src] | pattern_traits[:inc].map{|f| f % [module_name]}
|
138
|
-
when :inc then @options[:includes][:inc]
|
139
|
-
when :tst then @options[:includes][:tst] | pattern_traits[:inc].map{|f| "
|
148
|
+
:path => (Pathname.new("#{cfg[:path]}#{subfolder}") + filename).cleanpath,
|
149
|
+
:name => submodule_name,
|
150
|
+
:template => cfg[:template],
|
151
|
+
:boilerplate => cfg[:boilerplate],
|
152
|
+
:includes => case(cfg[:inc])
|
153
|
+
when :src then (@options[:includes][:src] || []) | pattern_traits[:inc].map{|f| f % [module_name]}
|
154
|
+
when :inc then (@options[:includes][:inc] || [])
|
155
|
+
when :tst then (@options[:includes][:tst] || []) | pattern_traits[:inc].map{|f| "#{@options[:mock_prefix]}#{f}" % [module_name]}
|
140
156
|
end
|
141
157
|
}
|
142
158
|
end
|
@@ -145,6 +161,27 @@ class UnityModuleGenerator
|
|
145
161
|
return files
|
146
162
|
end
|
147
163
|
|
164
|
+
############################
|
165
|
+
def create_filename(part1, part2="")
|
166
|
+
if part2.empty?
|
167
|
+
case(@options[:naming])
|
168
|
+
when 'bumpy' then part1
|
169
|
+
when 'camel' then part1
|
170
|
+
when 'snake' then part1.downcase
|
171
|
+
when 'caps' then part1.upcase
|
172
|
+
else part1.downcase
|
173
|
+
end
|
174
|
+
else
|
175
|
+
case(@options[:naming])
|
176
|
+
when 'bumpy' then part1 + part2
|
177
|
+
when 'camel' then part1 + part2
|
178
|
+
when 'snake' then part1.downcase + "_" + part2.downcase
|
179
|
+
when 'caps' then part1.upcase + "_" + part2.upcase
|
180
|
+
else part1.downcase + "_" + part2.downcase
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
148
185
|
############################
|
149
186
|
def generate(module_name, pattern=nil)
|
150
187
|
|
@@ -157,8 +194,9 @@ class UnityModuleGenerator
|
|
157
194
|
|
158
195
|
# Create Source Modules
|
159
196
|
files.each_with_index do |file, i|
|
197
|
+
FileUtils.mkdir_p(File.dirname(file[:path]), :verbose => false) # Create the path first if necessary.
|
160
198
|
File.open(file[:path], 'w') do |f|
|
161
|
-
f.write(file[:boilerplate] % [file[:name]]) unless file[:boilerplate].nil?
|
199
|
+
f.write("#{file[:boilerplate]}\n" % [file[:name]]) unless file[:boilerplate].nil?
|
162
200
|
f.write(file[:template] % [ file[:name],
|
163
201
|
file[:includes].map{|f| "#include \"#{f}\"\n"}.join,
|
164
202
|
file[:name].upcase ]
|
@@ -210,13 +248,14 @@ if ($0 == __FILE__)
|
|
210
248
|
# Parse the command line parameters.
|
211
249
|
ARGV.each do |arg|
|
212
250
|
case(arg)
|
213
|
-
when /^-d/
|
214
|
-
when /^-u/
|
215
|
-
when /^-p(\w+)
|
216
|
-
when /^-s(.+)
|
217
|
-
when /^-i(.+)
|
218
|
-
when /^-t(.+)
|
219
|
-
when /^-
|
251
|
+
when /^-d/ then destroy = true
|
252
|
+
when /^-u/ then options[:update_svn] = true
|
253
|
+
when /^-p\"?(\w+)\"?/ then options[:pattern] = $1
|
254
|
+
when /^-s\"?(.+)\"?/ then options[:path_src] = $1
|
255
|
+
when /^-i\"?(.+)\"?/ then options[:path_inc] = $1
|
256
|
+
when /^-t\"?(.+)\"?/ then options[:path_tst] = $1
|
257
|
+
when /^-n\"?(.+)\"?/ then options[:naming] = $1
|
258
|
+
when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config($1)
|
220
259
|
when /^(\w+)/
|
221
260
|
raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?
|
222
261
|
module_name = arg
|
@@ -234,12 +273,18 @@ if ($0 == __FILE__)
|
|
234
273
|
" -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)",
|
235
274
|
" -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)",
|
236
275
|
" -p\"MCH\" sets the output pattern to MCH.",
|
237
|
-
" dh
|
238
|
-
" dih
|
239
|
-
" mch
|
240
|
-
" mvp
|
241
|
-
" src
|
276
|
+
" dh - driver hardware.",
|
277
|
+
" dih - driver interrupt hardware.",
|
278
|
+
" mch - model conductor hardware.",
|
279
|
+
" mvp - model view presenter.",
|
280
|
+
" src - just a source module, header and test. (DEFAULT)",
|
281
|
+
" test - just a test file.",
|
242
282
|
" -d destroy module instead of creating it.",
|
283
|
+
" -n\"camel\" sets the file naming convention.",
|
284
|
+
" bumpy - BumpyCaseFilenames.",
|
285
|
+
" camel - camelCaseFilenames.",
|
286
|
+
" snake - snake_case_filenames. (DEFAULT)",
|
287
|
+
" caps - CAPS_CASE_FILENAMES.",
|
243
288
|
" -u update subversion too (requires subversion command line)",
|
244
289
|
" -y\"my.yml\" selects a different yaml config file for module generation",
|
245
290
|
"" ].join("\n")
|
@@ -254,5 +299,3 @@ if ($0 == __FILE__)
|
|
254
299
|
end
|
255
300
|
|
256
301
|
end
|
257
|
-
|
258
|
-
|
@@ -9,7 +9,7 @@
|
|
9
9
|
#include "unity_fixture.h"
|
10
10
|
#include "unity_internals.h"
|
11
11
|
|
12
|
-
struct
|
12
|
+
struct UNITY_FIXTURE_T UnityFixture;
|
13
13
|
|
14
14
|
/* If you decide to use the function pointer approach.
|
15
15
|
* Build with -D UNITY_OUTPUT_CHAR=outputChar and include <stdio.h>
|
@@ -13,14 +13,14 @@ extern "C"
|
|
13
13
|
{
|
14
14
|
#endif
|
15
15
|
|
16
|
-
struct
|
16
|
+
struct UNITY_FIXTURE_T
|
17
17
|
{
|
18
18
|
int Verbose;
|
19
19
|
unsigned int RepeatCount;
|
20
20
|
const char* NameFilter;
|
21
21
|
const char* GroupFilter;
|
22
22
|
};
|
23
|
-
extern struct
|
23
|
+
extern struct UNITY_FIXTURE_T UnityFixture;
|
24
24
|
|
25
25
|
typedef void unityfunction(void);
|
26
26
|
void UnityTestRunner(unityfunction* setup,
|
@@ -138,8 +138,8 @@ TEST(UnityFixture, FreeNULLSafety)
|
|
138
138
|
|
139
139
|
TEST(UnityFixture, ConcludeTestIncrementsFailCount)
|
140
140
|
{
|
141
|
-
|
142
|
-
|
141
|
+
UNITY_UINT savedFails = Unity.TestFailures;
|
142
|
+
UNITY_UINT savedIgnores = Unity.TestIgnores;
|
143
143
|
UnityOutputCharSpy_Enable(1);
|
144
144
|
Unity.CurrentTestFailed = 1;
|
145
145
|
UnityConcludeFixtureTest(); /* Resets TestFailed for this test to pass */
|
@@ -301,7 +301,7 @@ TEST(UnityCommandOptions, GroupOrNameFilterWithoutStringFails)
|
|
301
301
|
|
302
302
|
TEST(UnityCommandOptions, GroupFilterReallyFilters)
|
303
303
|
{
|
304
|
-
|
304
|
+
UNITY_UINT saved = Unity.NumberOfTests;
|
305
305
|
TEST_ASSERT_EQUAL(0, UnityGetCommandLineOptions(4, unknownCommand));
|
306
306
|
UnityIgnoreTest(NULL, "non-matching", NULL);
|
307
307
|
TEST_ASSERT_EQUAL(saved, Unity.NumberOfTests);
|