ceedling 1.1.4 → 1.1.6
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/GIT_COMMIT_SHA +1 -1
- data/README.md +1 -1
- data/assets/tests_with_conditional_includes/src/feature_config.h +13 -0
- data/assets/tests_with_conditional_includes/src/feature_extra.h +13 -0
- data/assets/tests_with_conditional_includes/src/local_flag_extra.h +13 -0
- data/assets/tests_with_conditional_includes/src/nested_extra.h +13 -0
- data/assets/tests_with_conditional_includes/src/nested_wrapper.h +16 -0
- data/assets/tests_with_conditional_includes/src/project_flag_extra.h +13 -0
- data/assets/tests_with_conditional_includes/src/widget.c +48 -0
- data/assets/tests_with_conditional_includes/src/widget.h +15 -0
- data/assets/tests_with_conditional_includes/src/widget_feature.c +29 -0
- data/assets/tests_with_conditional_includes/src/widget_feature.h +13 -0
- data/assets/tests_with_conditional_includes/test/test_widget.c +44 -0
- data/assets/tests_with_conditional_includes/test/test_widget_feature.c +31 -0
- data/docs/Changelog.md +31 -1
- data/docs/mkdocs/configuration/reference/partials.md +7 -7
- data/examples/wondrous_forest/src/SensorHal.h +13 -0
- data/examples/wondrous_forest/src/TemperatureSensor.c +12 -5
- data/examples/wondrous_forest/src/TemperatureSensor.h +5 -4
- data/examples/wondrous_forest/test/TestTemperatureSensor.c +32 -3
- data/lib/ceedling/generators/generator_partials.rb +20 -1
- data/lib/ceedling/generators/generator_test_runner.rb +25 -1
- data/lib/ceedling/partials/partializer.rb +8 -1
- data/lib/ceedling/preprocess/preprocessinator.rb +22 -0
- data/lib/ceedling/preprocess/preprocessinator_includes_handler.rb +33 -0
- data/lib/ceedling/test_invoker/test_build_executor.rb +3 -1
- data/lib/version.rb +1 -1
- data/site-local/configuration/reference/partials.html +11 -10
- data/site-local/sitemap.xml.gz +0 -0
- data/spec/support/system/spec_system_helper.rb +11 -0
- data/spec/support/system/system_context.rb +18 -9
- data/spec/system/conditional_include_macro_visibility_spec.rb +152 -0
- data/spec/system/encoding_stress_spec.rb +4 -4
- data/spec/system/example_wondrous_forest_spec.rb +2 -2
- data/spec/system/support/common_test_cases.rb +5 -1
- data/spec/system/test_runner_system_include_spec.rb +90 -0
- data/spec/units/generators/generator_partials_spec.rb +111 -8
- data/spec/units/generators/generator_test_runner_spec.rb +69 -0
- data/spec/units/partials/partializer_spec.rb +69 -0
- data/spec/units/preprocess/preprocessinator_includes_handler_spec.rb +61 -0
- data/spec/units/preprocess/preprocessinator_spec.rb +136 -0
- data/vendor/c_exception/lib/CException.h +1 -1
- data/vendor/c_exception/project.yml +2 -2
- data/vendor/c_exception/test/TestException.c +1 -1
- data/vendor/c_exception/test/support/CExceptionConfig.h +5 -11
- data/vendor/cmock/docs/CMockChangeLog.md +23 -22
- data/vendor/cmock/scripts/create_makefile.rb +4 -3
- data/vendor/cmock/src/cmock.h +1 -1
- data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
- data/vendor/cmock/vendor/c_exception/project.yml +2 -2
- data/vendor/cmock/vendor/c_exception/test/TestException.c +1 -1
- data/vendor/cmock/vendor/c_exception/test/support/CExceptionConfig.h +5 -11
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +85 -29
- data/vendor/cmock/vendor/unity/docs/UnityChangeLog.md +1 -0
- data/vendor/cmock/vendor/unity/examples/unity_config.h +8 -0
- data/vendor/cmock/vendor/unity/src/unity.c +9 -1
- data/vendor/cmock/vendor/unity/src/unity.h +1 -1
- data/vendor/cmock/vendor/unity/test/rakefile +2 -1
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorEmpty.c +13 -0
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +31 -0
- data/vendor/unity/auto/generate_test_runner.rb +63 -57
- data/vendor/unity/docs/UnityChangeLog.md +1 -0
- data/vendor/unity/examples/unity_config.h +8 -0
- data/vendor/unity/src/unity.c +9 -1
- data/vendor/unity/src/unity.h +1 -1
- data/vendor/unity/test/rakefile +2 -1
- data/vendor/unity/test/tests/test_generate_test_runner.rb +20 -0
- metadata +21 -3
- data/vendor/cmock/vendor/unity/auto/run_test.erb +0 -37
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
require 'spec_helper'
|
|
9
9
|
require 'ceedling/generators/generator_test_runner'
|
|
10
10
|
require 'ceedling/parsing_parcels'
|
|
11
|
+
require 'ceedling/includes/includes'
|
|
11
12
|
|
|
12
13
|
describe GeneratorTestRunner do
|
|
13
14
|
before(:each) do
|
|
@@ -141,4 +142,72 @@ describe GeneratorTestRunner do
|
|
|
141
142
|
)
|
|
142
143
|
end
|
|
143
144
|
end
|
|
145
|
+
|
|
146
|
+
# ===========================================================================
|
|
147
|
+
describe '#generate' do
|
|
148
|
+
# ===========================================================================
|
|
149
|
+
# Regression coverage for https://github.com/ThrowTheSwitch/Ceedling/issues/1236:
|
|
150
|
+
# a system #include with a directory component (e.g. <sys/stat.h>) was rendered
|
|
151
|
+
# into the generated runner as a bare, unbracketed basename ("stat.h"), losing
|
|
152
|
+
# both the directory and the user/system distinction, breaking runner compilation.
|
|
153
|
+
#
|
|
154
|
+
# @unity_runner_generator is a real UnityTestRunnerGenerator, constructed directly
|
|
155
|
+
# inside #initialize rather than injected -- swapped out for a double here so these
|
|
156
|
+
# specs assert on exactly what GeneratorTestRunner itself hands off, independent of
|
|
157
|
+
# Unity's own generated file formatting.
|
|
158
|
+
def build_and_capture_includes(includes:, mocks: [])
|
|
159
|
+
runner = build_runner( test_file_contents: "void test_Thing(void) {}\n" )
|
|
160
|
+
|
|
161
|
+
captured = nil
|
|
162
|
+
fake_generator = double('unity_runner_generator')
|
|
163
|
+
allow(fake_generator).to receive(:generate) do |*args|
|
|
164
|
+
captured = args[4]
|
|
165
|
+
end
|
|
166
|
+
runner.instance_variable_set(:@unity_runner_generator, fake_generator)
|
|
167
|
+
|
|
168
|
+
runner.generate(
|
|
169
|
+
module_name: 'test_thing',
|
|
170
|
+
runner_filepath: '/build/test/runners/test_thing_runner.c',
|
|
171
|
+
mocks: mocks,
|
|
172
|
+
includes: includes
|
|
173
|
+
)
|
|
174
|
+
|
|
175
|
+
return captured
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
it 'renders a system include with a directory component in angle brackets, directory intact' do
|
|
179
|
+
captured = build_and_capture_includes( includes: [ SystemInclude.new('sys/stat.h') ] )
|
|
180
|
+
|
|
181
|
+
expect( captured ).to eq( ['<sys/stat.h>'] )
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
it 'prefers a reconciled system include\'s include_path over its resolved filepath' do
|
|
185
|
+
# Mirrors what Includes.reconcile actually produces: filepath is the real,
|
|
186
|
+
# resolved (possibly absolute) location; include_path is the original,
|
|
187
|
+
# as-written directive text that must be what's rendered.
|
|
188
|
+
reconciled = SystemInclude.new('/usr/include/sys/stat.h', include_path: 'sys/stat.h')
|
|
189
|
+
|
|
190
|
+
captured = build_and_capture_includes( includes: [ reconciled ] )
|
|
191
|
+
|
|
192
|
+
expect( captured ).to eq( ['<sys/stat.h>'] )
|
|
193
|
+
end
|
|
194
|
+
|
|
195
|
+
it 'renders a user include with a directory component down to its bare filename, unchanged from prior behavior' do
|
|
196
|
+
# Unlike a system header, a project's own directories are exposed to the
|
|
197
|
+
# compiler as a flat list of -I search paths -- rendering a user include's
|
|
198
|
+
# own directory component here breaks resolution rather than fixing anything,
|
|
199
|
+
# so this behavior is intentionally unchanged by the issue #1236 fix.
|
|
200
|
+
captured = build_and_capture_includes( includes: [ UserInclude.new('sub/header.h') ] )
|
|
201
|
+
|
|
202
|
+
expect( captured ).to eq( ['header.h'] )
|
|
203
|
+
end
|
|
204
|
+
|
|
205
|
+
it 'renders a mixed list of system and user includes each in their own correct form' do
|
|
206
|
+
captured = build_and_capture_includes(
|
|
207
|
+
includes: [ SystemInclude.new('sys/stat.h'), UserInclude.new('sub/header.h') ]
|
|
208
|
+
)
|
|
209
|
+
|
|
210
|
+
expect( captured ).to eq( ['<sys/stat.h>', 'header.h'] )
|
|
211
|
+
end
|
|
212
|
+
end
|
|
144
213
|
end
|
|
@@ -871,6 +871,75 @@ describe Partializer do
|
|
|
871
871
|
expect(result).not_to include(UserInclude.new('partial_module.h'))
|
|
872
872
|
end
|
|
873
873
|
|
|
874
|
+
# Regression test for #1215: PUBLIC/PRIVATE were once the only mock modes that existed,
|
|
875
|
+
# so this method's own "does this module have a mock to redirect to" check only ever
|
|
876
|
+
# listed those two. DEDUCT (MOCK_PARTIAL_ALL_MODULE) was added later without updating
|
|
877
|
+
# this check, so a module mocked via MOCK_PARTIAL_ALL_MODULE -- e.g. a vendor header
|
|
878
|
+
# whose only mockable functions are static inline, which requires DEDUCT to select at
|
|
879
|
+
# all -- was silently never redirected to its mock interface header.
|
|
880
|
+
it "remaps mockable deduct (ALL_MODULE) partial to interface header" do
|
|
881
|
+
includes = [UserInclude.new('header1.h'), UserInclude.new('partial_module.h'), UserInclude.new('header2.h')]
|
|
882
|
+
partials = {
|
|
883
|
+
'partial_module' => make_partial_config(mocks_type: Partials::DEDUCT)
|
|
884
|
+
}
|
|
885
|
+
impl_filename = 'module_impl.h'
|
|
886
|
+
interface_filename = 'partial_module_interface.h'
|
|
887
|
+
impl_header = UserInclude.new(impl_filename)
|
|
888
|
+
interface_header = UserInclude.new(interface_filename)
|
|
889
|
+
|
|
890
|
+
allow(@file_path_utils).to receive(:form_partial_implementation_header_filename)
|
|
891
|
+
.with('module')
|
|
892
|
+
.and_return(impl_filename)
|
|
893
|
+
|
|
894
|
+
allow(@file_path_utils).to receive(:form_partial_interface_header_filename)
|
|
895
|
+
.with('partial_module')
|
|
896
|
+
.and_return(interface_filename)
|
|
897
|
+
|
|
898
|
+
result = @partializer.remap_implementation_source_includes(
|
|
899
|
+
name: 'module',
|
|
900
|
+
includes: includes,
|
|
901
|
+
partials: partials
|
|
902
|
+
)
|
|
903
|
+
|
|
904
|
+
expect(result).to include(impl_header)
|
|
905
|
+
expect(result).to include(interface_header)
|
|
906
|
+
expect(result).to include(UserInclude.new('header1.h'))
|
|
907
|
+
expect(result).to include(UserInclude.new('header2.h'))
|
|
908
|
+
expect(result).not_to include(UserInclude.new('partial_module.h'))
|
|
909
|
+
end
|
|
910
|
+
|
|
911
|
+
# Same regression as the DEDUCT case above, for ACCUMULATE (MOCK_PARTIAL_MODULE).
|
|
912
|
+
it "remaps mockable accumulate partial to interface header" do
|
|
913
|
+
includes = [UserInclude.new('header1.h'), UserInclude.new('partial_module.h'), UserInclude.new('header2.h')]
|
|
914
|
+
partials = {
|
|
915
|
+
'partial_module' => make_partial_config(mocks_type: Partials::ACCUMULATE)
|
|
916
|
+
}
|
|
917
|
+
impl_filename = 'module_impl.h'
|
|
918
|
+
interface_filename = 'partial_module_interface.h'
|
|
919
|
+
impl_header = UserInclude.new(impl_filename)
|
|
920
|
+
interface_header = UserInclude.new(interface_filename)
|
|
921
|
+
|
|
922
|
+
allow(@file_path_utils).to receive(:form_partial_implementation_header_filename)
|
|
923
|
+
.with('module')
|
|
924
|
+
.and_return(impl_filename)
|
|
925
|
+
|
|
926
|
+
allow(@file_path_utils).to receive(:form_partial_interface_header_filename)
|
|
927
|
+
.with('partial_module')
|
|
928
|
+
.and_return(interface_filename)
|
|
929
|
+
|
|
930
|
+
result = @partializer.remap_implementation_source_includes(
|
|
931
|
+
name: 'module',
|
|
932
|
+
includes: includes,
|
|
933
|
+
partials: partials
|
|
934
|
+
)
|
|
935
|
+
|
|
936
|
+
expect(result).to include(impl_header)
|
|
937
|
+
expect(result).to include(interface_header)
|
|
938
|
+
expect(result).to include(UserInclude.new('header1.h'))
|
|
939
|
+
expect(result).to include(UserInclude.new('header2.h'))
|
|
940
|
+
expect(result).not_to include(UserInclude.new('partial_module.h'))
|
|
941
|
+
end
|
|
942
|
+
|
|
874
943
|
it "remaps multiple mockable partials to interface headers" do
|
|
875
944
|
includes = [
|
|
876
945
|
UserInclude.new('header1.h'),
|
|
@@ -339,6 +339,67 @@ RSpec.describe PreprocessinatorIncludesHandler do
|
|
|
339
339
|
end
|
|
340
340
|
|
|
341
341
|
|
|
342
|
+
# ===========================================================================
|
|
343
|
+
describe '#extract_bare_includes_from_text' do
|
|
344
|
+
# ===========================================================================
|
|
345
|
+
|
|
346
|
+
let(:filepath) { '/src/module.c' }
|
|
347
|
+
|
|
348
|
+
it 'extracts a simple user include' do
|
|
349
|
+
stub_file_open(filepath, "#include \"foo.h\"\n")
|
|
350
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
351
|
+
expect(result.map(&:filename)).to include('foo.h')
|
|
352
|
+
end
|
|
353
|
+
|
|
354
|
+
it 'extracts a system include too, unlike extract_user_includes_from_text' do
|
|
355
|
+
stub_file_open(filepath, "#include <stdio.h>\n")
|
|
356
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
357
|
+
expect(result.map(&:filename)).to include('stdio.h')
|
|
358
|
+
end
|
|
359
|
+
|
|
360
|
+
it 'returns plain Include objects, not UserInclude/SystemInclude' do
|
|
361
|
+
stub_file_open(filepath, "#include \"foo.h\"\n#include <stdio.h>\n")
|
|
362
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
363
|
+
expect(result).to all( be_an_instance_of(Include) )
|
|
364
|
+
end
|
|
365
|
+
|
|
366
|
+
it 'ignores includes inside line comments' do
|
|
367
|
+
stub_file_open(filepath, "// #include \"commented_out.h\"\n")
|
|
368
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
369
|
+
expect(result).to be_empty
|
|
370
|
+
end
|
|
371
|
+
|
|
372
|
+
it 'ignores includes inside block comments' do
|
|
373
|
+
content = "/* #include \"in_block.h\" */\n#include \"real.h\"\n"
|
|
374
|
+
stub_file_open(filepath, content)
|
|
375
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
376
|
+
expect(result.map(&:filename)).to contain_exactly('real.h')
|
|
377
|
+
end
|
|
378
|
+
|
|
379
|
+
# The defining difference from extract_user_includes_from_text: no conditional
|
|
380
|
+
# tracking at all -- an #include inside an #ifdef for an undefined macro is
|
|
381
|
+
# still captured, since this method's whole purpose is to see past a guard
|
|
382
|
+
# whose condition can't be evaluated without opening another header (issue #1223).
|
|
383
|
+
it 'captures a conditionally-guarded include regardless of whether the guard could be evaluated true' do
|
|
384
|
+
content = <<~C
|
|
385
|
+
#ifdef UNDEFINED_MACRO
|
|
386
|
+
#include "conditional.h"
|
|
387
|
+
#endif
|
|
388
|
+
C
|
|
389
|
+
stub_file_open(filepath, content)
|
|
390
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
391
|
+
expect(result.map(&:filename)).to include('conditional.h')
|
|
392
|
+
end
|
|
393
|
+
|
|
394
|
+
it 'removes a self-referential include matching the file being scanned' do
|
|
395
|
+
stub_file_open(filepath, "#include \"#{filepath}\"\n#include \"foo.h\"\n")
|
|
396
|
+
result = subject.extract_bare_includes_from_text(filepath: filepath)
|
|
397
|
+
expect(result.map(&:filename)).to contain_exactly('foo.h')
|
|
398
|
+
end
|
|
399
|
+
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
|
|
342
403
|
# ===========================================================================
|
|
343
404
|
describe '#extract_system_includes_from_text' do
|
|
344
405
|
# ===========================================================================
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
# =========================================================================
|
|
2
|
+
# Ceedling - Test-Centered Build System for C
|
|
3
|
+
# ThrowTheSwitch.org
|
|
4
|
+
# Copyright (c) 2010-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
# =========================================================================
|
|
7
|
+
|
|
8
|
+
require 'spec_helper'
|
|
9
|
+
require 'ceedling/preprocess/preprocessinator'
|
|
10
|
+
require 'ceedling/includes/includes'
|
|
11
|
+
|
|
12
|
+
RSpec.describe Preprocessinator do
|
|
13
|
+
|
|
14
|
+
before :each do
|
|
15
|
+
@includes_handler = double('preprocessinator_includes_handler')
|
|
16
|
+
@comment_stripper = double('preprocessinator_comment_stripper')
|
|
17
|
+
@file_assembler = double('preprocessinator_file_assembler')
|
|
18
|
+
@reconstructor = double('preprocessinator_reconstructor')
|
|
19
|
+
@file_path_utils = double('file_path_utils')
|
|
20
|
+
@tool_executor = double('tool_executor')
|
|
21
|
+
@file_wrapper = double('file_wrapper')
|
|
22
|
+
@plugin_manager = double('plugin_manager')
|
|
23
|
+
@configurator = double('configurator')
|
|
24
|
+
@loginator = double('loginator')
|
|
25
|
+
@reportinator = double('reportinator')
|
|
26
|
+
|
|
27
|
+
allow(@loginator).to receive(:log)
|
|
28
|
+
allow(@loginator).to receive(:log_list)
|
|
29
|
+
allow(@reportinator).to receive(:generate_module_progress).and_return('')
|
|
30
|
+
allow(@configurator).to receive(:cmock_mock_prefix).and_return('Mock')
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
subject do
|
|
34
|
+
Preprocessinator.new(
|
|
35
|
+
preprocessinator_includes_handler: @includes_handler,
|
|
36
|
+
preprocessinator_comment_stripper: @comment_stripper,
|
|
37
|
+
preprocessinator_file_assembler: @file_assembler,
|
|
38
|
+
preprocessinator_reconstructor: @reconstructor,
|
|
39
|
+
file_path_utils: @file_path_utils,
|
|
40
|
+
tool_executor: @tool_executor,
|
|
41
|
+
file_wrapper: @file_wrapper,
|
|
42
|
+
plugin_manager: @plugin_manager,
|
|
43
|
+
configurator: @configurator,
|
|
44
|
+
loginator: @loginator,
|
|
45
|
+
reportinator: @reportinator
|
|
46
|
+
)
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
# ===========================================================================
|
|
50
|
+
describe '#preprocess_file_includes_common' do
|
|
51
|
+
# ===========================================================================
|
|
52
|
+
|
|
53
|
+
let(:filepath) { '/src/module.c' }
|
|
54
|
+
|
|
55
|
+
def call_it(defines: [])
|
|
56
|
+
subject.send(
|
|
57
|
+
:preprocess_file_includes_common,
|
|
58
|
+
test: 'test',
|
|
59
|
+
filepath: filepath,
|
|
60
|
+
directives_only_filepath: '/build/directives_only/module.c',
|
|
61
|
+
fallback: false,
|
|
62
|
+
flags: [],
|
|
63
|
+
include_paths: [],
|
|
64
|
+
vendor_paths: [],
|
|
65
|
+
defines: defines
|
|
66
|
+
)
|
|
67
|
+
end
|
|
68
|
+
|
|
69
|
+
before do
|
|
70
|
+
# Force the cache-miss path so real extraction runs every time.
|
|
71
|
+
allow(@file_path_utils).to receive(:form_preprocessed_includes_list_filepath).and_return('/build/includes/module.c.yml')
|
|
72
|
+
allow(@file_wrapper).to receive(:newer?).and_return(false)
|
|
73
|
+
allow(@includes_handler).to receive(:write_includes_list)
|
|
74
|
+
|
|
75
|
+
allow(@includes_handler).to receive(:extract_system_includes_preprocess).and_return([])
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
# Regression coverage for #1223: the gcc-based bare pass runs against an
|
|
79
|
+
# isolated copy that can never open another header, so a conditional
|
|
80
|
+
# #include guarded by a macro defined by an earlier #include in the same
|
|
81
|
+
# file evaluates false there and is silently dropped from that pass's own
|
|
82
|
+
# result. extract_bare_includes_from_text (a plain literal-text scan, no
|
|
83
|
+
# conditional evaluation at all) still sees it. Reconciliation should keep
|
|
84
|
+
# it once the accurate pass (user_includes here) also confirms it's real.
|
|
85
|
+
it "keeps an entry the gcc bare pass missed but the text-scan bare pass and the accurate pass both found" do
|
|
86
|
+
allow(@includes_handler).to receive(:extract_bare_includes).and_return(
|
|
87
|
+
[ Include.new('Types.h') ]
|
|
88
|
+
)
|
|
89
|
+
allow(@includes_handler).to receive(:extract_bare_includes_from_text).and_return(
|
|
90
|
+
[ Include.new('Types.h'), Include.new('types2.h') ]
|
|
91
|
+
)
|
|
92
|
+
allow(@includes_handler).to receive(:extract_user_includes_preprocess).and_return(
|
|
93
|
+
[ UserInclude.new('Types.h'), UserInclude.new('types2.h') ]
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
result = call_it()
|
|
97
|
+
|
|
98
|
+
expect(result.map(&:filename)).to include('types2.h')
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
# The union only ever adds candidates for reconcile to match against the
|
|
102
|
+
# accurate pass -- it must never single-handedly promote an entry neither
|
|
103
|
+
# gcc's bare pass nor the accurate pass itself ever reported.
|
|
104
|
+
it "does not introduce an entry the text-scan bare pass found but the accurate pass never confirms" do
|
|
105
|
+
allow(@includes_handler).to receive(:extract_bare_includes).and_return([])
|
|
106
|
+
allow(@includes_handler).to receive(:extract_bare_includes_from_text).and_return(
|
|
107
|
+
[ Include.new('phantom.h') ]
|
|
108
|
+
)
|
|
109
|
+
allow(@includes_handler).to receive(:extract_user_includes_preprocess).and_return([])
|
|
110
|
+
|
|
111
|
+
result = call_it()
|
|
112
|
+
|
|
113
|
+
expect(result.map(&:filename)).not_to include('phantom.h')
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
# Both bare sources finding the same entry must not produce a duplicate
|
|
117
|
+
# (the union is deduplicated by filename before being handed to reconcile).
|
|
118
|
+
it "does not duplicate an entry both bare passes agree on" do
|
|
119
|
+
allow(@includes_handler).to receive(:extract_bare_includes).and_return(
|
|
120
|
+
[ Include.new('Types.h') ]
|
|
121
|
+
)
|
|
122
|
+
allow(@includes_handler).to receive(:extract_bare_includes_from_text).and_return(
|
|
123
|
+
[ Include.new('Types.h') ]
|
|
124
|
+
)
|
|
125
|
+
allow(@includes_handler).to receive(:extract_user_includes_preprocess).and_return(
|
|
126
|
+
[ UserInclude.new('Types.h') ]
|
|
127
|
+
)
|
|
128
|
+
|
|
129
|
+
result = call_it()
|
|
130
|
+
|
|
131
|
+
expect(result.map(&:filename)).to eq(['Types.h'])
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
end
|
|
@@ -18,7 +18,7 @@ extern "C"
|
|
|
18
18
|
|
|
19
19
|
#define CEXCEPTION_VERSION_MAJOR 1
|
|
20
20
|
#define CEXCEPTION_VERSION_MINOR 3
|
|
21
|
-
#define CEXCEPTION_VERSION_BUILD
|
|
21
|
+
#define CEXCEPTION_VERSION_BUILD 5
|
|
22
22
|
#define CEXCEPTION_VERSION ((CEXCEPTION_VERSION_MAJOR << 16) | (CEXCEPTION_VERSION_MINOR << 8) | CEXCEPTION_VERSION_BUILD)
|
|
23
23
|
|
|
24
24
|
//To Use CException, you have a number of options:
|
|
@@ -231,8 +231,8 @@
|
|
|
231
231
|
#- ReportGenerator # Use ReportGenerator to create the specified reports.
|
|
232
232
|
:reports: # Specify one or more reports to generate.
|
|
233
233
|
# Make an HTML summary report.
|
|
234
|
-
- HtmlBasic
|
|
235
|
-
|
|
234
|
+
# - HtmlBasic
|
|
235
|
+
- HtmlDetailed
|
|
236
236
|
# - Text
|
|
237
237
|
# - Cobertura
|
|
238
238
|
# - SonarQube
|
|
@@ -20,17 +20,11 @@ extern volatile int TestingTheFallbackId;
|
|
|
20
20
|
#define CEXCEPTION_NONE (1234)
|
|
21
21
|
|
|
22
22
|
// Optionally define a special handler for unhandled exceptions
|
|
23
|
-
#define CEXCEPTION_NO_CATCH_HANDLER(id)
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} \
|
|
29
|
-
else \
|
|
30
|
-
{ \
|
|
31
|
-
TestingTheFallbackId = id; \
|
|
32
|
-
TestingTheFallback--; \
|
|
33
|
-
} \
|
|
23
|
+
#define CEXCEPTION_NO_CATCH_HANDLER(id) \
|
|
24
|
+
{ \
|
|
25
|
+
TEST_ASSERT_GREATER_THAN_INT_MESSAGE(0, TestingTheFallback, "Unexpected Exception!"); \
|
|
26
|
+
TestingTheFallbackId = id; \
|
|
27
|
+
TestingTheFallback--; \
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
// Multi-Tasking environments will need a couple of macros defined to make this library
|
|
@@ -18,35 +18,36 @@ Prior to 2008, the project was an internal project and not released to the publi
|
|
|
18
18
|
New Features:
|
|
19
19
|
|
|
20
20
|
- Significant improvements to array and pointer handling:
|
|
21
|
-
- Arrays are now passed as arrays. Yes, even multidimensional ones. (Fixes #69
|
|
22
|
-
|
|
23
|
-
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
21
|
+
- Arrays are now passed as arrays. Yes, even multidimensional ones. (Fixes [#69](https://github.com/ThrowTheSwitch/CMock/issues/69)
|
|
22
|
+
, [#119](https://github.com/ThrowTheSwitch/CMock/issues/119), [#213](https://github.com/ThrowTheSwitch/CMock/issues/213), [#422](https://github.com/ThrowTheSwitch/CMock/issues/422))
|
|
23
|
+
- Array plugin now supports comparing `char*` (string) arguments as byte arrays via `_ExpectWithArray`, while still treating them as strings via `_Expect` (Fixes [#262](https://github.com/ThrowTheSwitch/CMock/issues/262) and [#177](https://github.com/ThrowTheSwitch/CMock/issues/177))
|
|
24
|
+
- Improved automatic detection of pointer/length argument pairs (Fixes [#520](https://github.com/ThrowTheSwitch/CMock/issues/520))
|
|
25
|
+
- When a pointer is auto-paired with a size argument, `_ExpectWithArrayExtended` is also generated as a fallback to allow explicit depth override (Fixes [#476](https://github.com/ThrowTheSwitch/CMock/issues/476))
|
|
26
|
+
- `void*` arguments now default to pointer comparison without the array plugin, and to byte-by-byte comparison when the array plugin is active (Fixes [#400](https://github.com/ThrowTheSwitch/CMock/issues/400))
|
|
27
|
+
- Handles *simple* preprocessor features like #if 1 and #if 0 (Fixes [#163](https://github.com/ThrowTheSwitch/CMock/issues/163))
|
|
28
|
+
- Ignores static assertions of various types (Fixes [#128](https://github.com/ThrowTheSwitch/CMock/issues/128))
|
|
29
|
+
- Added option to trace all mock setup and mocked calls (Implements [#403](https://github.com/ThrowTheSwitch/CMock/issues/403))
|
|
29
30
|
- Significant improvements to header parsing speed
|
|
30
31
|
|
|
31
32
|
Significant Bugfixes:
|
|
32
33
|
|
|
33
|
-
- Fixed matching of pointer/len argument pairs in reverse order (Fixes #479)
|
|
34
|
-
- Fixed handling of array of pointers or a pointer to an array (Fixes #450)
|
|
35
|
-
- Fixed const and pointer order handling issues (Fixes #484 and #485)
|
|
36
|
-
- Fixed handling of skeleton paths (Fixes #488)
|
|
37
|
-
- Fixed handling of memory alignment issues (Fixes #178)
|
|
38
|
-
- Fixed handling of failures in teardown (#67)
|
|
39
|
-
- Improved handling of function-looking structs (Fixes #513 and #334)
|
|
40
|
-
- Improved handling of function-looking macros (Fixes #502)
|
|
41
|
-
- Improved handling of volatiles (Fixes #110 and #135)
|
|
42
|
-
- Improved handling of stub and callback counters (Fixes #132)
|
|
43
|
-
- Improved handling and testing of Windows (Fixes #435)
|
|
34
|
+
- Fixed matching of pointer/len argument pairs in reverse order (Fixes [#479](https://github.com/ThrowTheSwitch/CMock/issues/479))
|
|
35
|
+
- Fixed handling of array of pointers or a pointer to an array (Fixes [#450](https://github.com/ThrowTheSwitch/CMock/issues/450))
|
|
36
|
+
- Fixed const and pointer order handling issues (Fixes [#484](https://github.com/ThrowTheSwitch/CMock/issues/484) and [#485](https://github.com/ThrowTheSwitch/CMock/issues/485))
|
|
37
|
+
- Fixed handling of skeleton paths (Fixes [#488](https://github.com/ThrowTheSwitch/CMock/issues/488))
|
|
38
|
+
- Fixed handling of memory alignment issues (Fixes [#178](https://github.com/ThrowTheSwitch/CMock/issues/178))
|
|
39
|
+
- Fixed handling of failures in teardown ([#67](https://github.com/ThrowTheSwitch/CMock/issues/67))
|
|
40
|
+
- Improved handling of function-looking structs (Fixes [#513](https://github.com/ThrowTheSwitch/CMock/issues/513) and [#334](https://github.com/ThrowTheSwitch/CMock/issues/334))
|
|
41
|
+
- Improved handling of function-looking macros (Fixes [#502](https://github.com/ThrowTheSwitch/CMock/issues/502))
|
|
42
|
+
- Improved handling of volatiles (Fixes #110 and [#135](https://github.com/ThrowTheSwitch/CMock/issues/135))
|
|
43
|
+
- Improved handling of stub and callback counters (Fixes [#132](https://github.com/ThrowTheSwitch/CMock/issues/132))
|
|
44
|
+
- Improved handling and testing of Windows (Fixes [#435](https://github.com/ThrowTheSwitch/CMock/issues/435))
|
|
44
45
|
|
|
45
46
|
Other:
|
|
46
47
|
|
|
47
|
-
- Added verification that memory errors are reported and stop tests (Verifies #463)
|
|
48
|
-
- Added verification that CMock features pass Valgrind (Verifies #506)
|
|
49
|
-
- Documented custom type support (#124)
|
|
48
|
+
- Added verification that memory errors are reported and stop tests (Verifies [#463](https://github.com/ThrowTheSwitch/CMock/issues/463))
|
|
49
|
+
- Added verification that CMock features pass Valgrind (Verifies [#506](https://github.com/ThrowTheSwitch/CMock/issues/506))
|
|
50
|
+
- Documented custom type support ([#124](https://github.com/ThrowTheSwitch/CMock/issues/124))
|
|
50
51
|
|
|
51
52
|
#### Major Code/Doc Contributors
|
|
52
53
|
|
|
@@ -137,10 +137,11 @@ File.open(TEST_MAKEFILE, 'w') do |mkfile|
|
|
|
137
137
|
mkfile.puts ''
|
|
138
138
|
|
|
139
139
|
# Collect mocks to generate
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
local_mocks = cfg[:includes][:headers].select do |name|
|
|
141
|
+
raise 'Mocking of system headers is not yet supported!' if name =~ /^</
|
|
142
142
|
|
|
143
|
-
|
|
143
|
+
(name =~ MOCK_MATCHER)
|
|
144
|
+
end
|
|
144
145
|
|
|
145
146
|
module_names_to_mock = local_mocks.map { |name| name.sub(/#{MOCK_PREFIX}/, '').to_s }
|
|
146
147
|
headers_to_mock = []
|
data/vendor/cmock/src/cmock.h
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
|
|
13
13
|
#define CMOCK_VERSION_MAJOR 2
|
|
14
14
|
#define CMOCK_VERSION_MINOR 7
|
|
15
|
-
#define CMOCK_VERSION_BUILD
|
|
15
|
+
#define CMOCK_VERSION_BUILD 2
|
|
16
16
|
#define CMOCK_VERSION ((CMOCK_VERSION_MAJOR << 16) | (CMOCK_VERSION_MINOR << 8) | CMOCK_VERSION_BUILD)
|
|
17
17
|
|
|
18
18
|
/* should be big enough to index full range of CMOCK_MEM_MAX */
|
|
@@ -18,7 +18,7 @@ extern "C"
|
|
|
18
18
|
|
|
19
19
|
#define CEXCEPTION_VERSION_MAJOR 1
|
|
20
20
|
#define CEXCEPTION_VERSION_MINOR 3
|
|
21
|
-
#define CEXCEPTION_VERSION_BUILD
|
|
21
|
+
#define CEXCEPTION_VERSION_BUILD 5
|
|
22
22
|
#define CEXCEPTION_VERSION ((CEXCEPTION_VERSION_MAJOR << 16) | (CEXCEPTION_VERSION_MINOR << 8) | CEXCEPTION_VERSION_BUILD)
|
|
23
23
|
|
|
24
24
|
//To Use CException, you have a number of options:
|
|
@@ -231,8 +231,8 @@
|
|
|
231
231
|
#- ReportGenerator # Use ReportGenerator to create the specified reports.
|
|
232
232
|
:reports: # Specify one or more reports to generate.
|
|
233
233
|
# Make an HTML summary report.
|
|
234
|
-
- HtmlBasic
|
|
235
|
-
|
|
234
|
+
# - HtmlBasic
|
|
235
|
+
- HtmlDetailed
|
|
236
236
|
# - Text
|
|
237
237
|
# - Cobertura
|
|
238
238
|
# - SonarQube
|
|
@@ -20,17 +20,11 @@ extern volatile int TestingTheFallbackId;
|
|
|
20
20
|
#define CEXCEPTION_NONE (1234)
|
|
21
21
|
|
|
22
22
|
// Optionally define a special handler for unhandled exceptions
|
|
23
|
-
#define CEXCEPTION_NO_CATCH_HANDLER(id)
|
|
24
|
-
{
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
} \
|
|
29
|
-
else \
|
|
30
|
-
{ \
|
|
31
|
-
TestingTheFallbackId = id; \
|
|
32
|
-
TestingTheFallback--; \
|
|
33
|
-
} \
|
|
23
|
+
#define CEXCEPTION_NO_CATCH_HANDLER(id) \
|
|
24
|
+
{ \
|
|
25
|
+
TEST_ASSERT_GREATER_THAN_INT_MESSAGE(0, TestingTheFallback, "Unexpected Exception!"); \
|
|
26
|
+
TestingTheFallbackId = id; \
|
|
27
|
+
TestingTheFallback--; \
|
|
34
28
|
}
|
|
35
29
|
|
|
36
30
|
// Multi-Tasking environments will need a couple of macros defined to make this library
|