ceedling 0.28.2 → 0.28.3
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/assets/ceedling +3 -0
- data/assets/ceedling.cmd +1 -0
- data/assets/default_gitignore +5 -0
- data/assets/project_with_guts.yml +1 -0
- data/assets/project_with_guts_gcov.yml +3 -0
- data/assets/test_example_file_verbose.c +12 -0
- data/bin/ceedling +30 -6
- data/docs/CeedlingPacket.md +135 -23
- data/docs/CeedlingPacket.odt +0 -0
- data/examples/blinky/rakefile.rb +2 -1
- data/lib/ceedling/configurator.rb +7 -5
- data/lib/ceedling/configurator_builder.rb +10 -7
- data/lib/ceedling/configurator_plugins.rb +29 -24
- data/lib/ceedling/configurator_setup.rb +0 -1
- data/lib/ceedling/defaults.rb +7 -2
- data/lib/ceedling/dependinator.rb +10 -2
- data/lib/ceedling/file_finder.rb +57 -49
- data/lib/ceedling/file_path_utils.rb +12 -4
- data/lib/ceedling/file_wrapper.rb +4 -0
- data/lib/ceedling/generator.rb +4 -3
- data/lib/ceedling/generator_test_results.rb +15 -13
- data/lib/ceedling/plugin_manager.rb +18 -18
- data/lib/ceedling/plugin_reportinator.rb +3 -2
- data/lib/ceedling/plugin_reportinator_helper.rb +2 -3
- data/lib/ceedling/preprocessinator_extractor.rb +2 -2
- data/lib/ceedling/preprocessinator_includes_handler.rb +5 -0
- data/lib/ceedling/rakefile.rb +1 -0
- data/lib/ceedling/release_invoker_helper.rb +5 -2
- data/lib/ceedling/rules_release.rake +2 -1
- data/lib/ceedling/rules_tests.rake +18 -9
- data/lib/ceedling/rules_tests_deep_dependencies.rake +2 -2
- data/lib/ceedling/task_invoker.rb +15 -3
- data/lib/ceedling/tasks_vendor.rake +3 -3
- data/lib/ceedling/test_invoker.rb +39 -12
- data/lib/ceedling/test_invoker_helper.rb +5 -1
- data/lib/ceedling/tool_executor.rb +8 -4
- data/lib/ceedling/version.rb +1 -1
- data/out.fail +21 -0
- data/plugins/beep/README.md +22 -0
- data/plugins/beep/lib/beep.rb +40 -0
- data/plugins/bullseye/bullseye.rake +43 -36
- data/plugins/bullseye/config/defaults.yml +4 -0
- data/plugins/bullseye/lib/bullseye.rb +27 -5
- data/plugins/command_hooks/lib/command_hooks.rb +3 -0
- data/plugins/gcov/README.md +34 -1
- data/plugins/gcov/config/defaults.yml +3 -3
- data/plugins/gcov/gcov.rake +7 -5
- data/plugins/gcov/lib/gcov.rb +3 -1
- data/plugins/gcov/lib/gcov_constants.rb +2 -0
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +12 -9
- data/plugins/module_generator/lib/module_generator.rb +14 -1
- data/plugins/module_generator/module_generator.rake +21 -4
- data/plugins/raw_output_report/lib/raw_output_report.rb +41 -0
- data/spec/gcov/gcov_deployment_spec.rb +1 -1
- data/spec/gcov/gcov_test_cases_spec.rb +2 -2
- data/spec/generator_test_results_spec.rb +5 -0
- data/spec/preprocessinator_includes_handler_spec.rb +1 -0
- data/spec/spec_system_helper.rb +178 -4
- data/spec/support/test_example.fail +1 -0
- data/spec/support/test_example.pass +1 -0
- data/spec/support/test_example_empty.pass +1 -0
- data/spec/support/test_example_ignore.pass +1 -0
- data/spec/support/test_example_mangled.pass +1 -0
- data/spec/support/test_example_with_time.pass +22 -0
- data/spec/system/deployment_spec.rb +33 -0
- data/vendor/cmock/README.md +4 -3
- data/vendor/cmock/docs/CMock_Summary.md +1 -1
- data/vendor/cmock/lib/cmock_config.rb +4 -0
- data/vendor/cmock/lib/cmock_generator.rb +5 -2
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +4 -4
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +9 -11
- data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +0 -1
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +2 -3
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +2 -4
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +0 -2
- data/vendor/cmock/lib/cmock_generator_utils.rb +16 -3
- data/vendor/cmock/lib/cmock_header_parser.rb +59 -34
- data/vendor/cmock/release/build.info +1 -1
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/scripts/create_makefile.rb +17 -2
- data/vendor/cmock/src/cmock.c +13 -7
- data/vendor/cmock/test/test_helper.rb +11 -10
- data/vendor/cmock/test/unit/cmock_config_test.rb +4 -2
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +10 -4
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +20 -12
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +3 -3
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +8 -6
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +27 -10
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +108 -20
- data/vendor/cmock/vendor/c_exception/Gemfile +4 -0
- data/vendor/cmock/vendor/c_exception/Gemfile.lock +12 -0
- data/vendor/cmock/vendor/c_exception/LICENSE.txt +30 -0
- data/vendor/cmock/vendor/c_exception/README.md +162 -0
- data/vendor/cmock/vendor/c_exception/Rakefile +42 -0
- data/vendor/cmock/vendor/c_exception/docs/CException.md +292 -0
- data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.c +46 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.h +110 -0
- data/vendor/cmock/vendor/c_exception/makefile +24 -0
- data/vendor/cmock/vendor/c_exception/release/build.info +2 -0
- data/vendor/cmock/vendor/c_exception/release/version.info +2 -0
- data/vendor/cmock/vendor/c_exception/test/CExceptionConfig.h +46 -0
- data/vendor/cmock/vendor/c_exception/test/TestException.c +391 -0
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +67 -0
- data/vendor/cmock/vendor/unity/README.md +231 -0
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +118 -0
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +39 -0
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +36 -0
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +308 -0
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +457 -0
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +323 -0
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +252 -0
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +25 -0
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +6 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +139 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +136 -0
- data/vendor/cmock/vendor/unity/auto/unity_to_junit.py +146 -0
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +206 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +779 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +433 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +192 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +260 -0
- data/vendor/cmock/vendor/unity/docs/license.txt +21 -0
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +71 -0
- data/vendor/cmock/vendor/unity/examples/example_1/readme.txt +5 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +53 -0
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +57 -0
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +70 -0
- data/vendor/cmock/vendor/unity/examples/example_2/readme.txt +5 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +64 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +33 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +9 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +12 -0
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +10 -0
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +12 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +43 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +249 -0
- data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +13 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +11 -0
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +46 -0
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/unity_config.h +247 -0
- data/vendor/cmock/vendor/unity/extras/eclipse/error_parsers.txt +26 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +48 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +178 -0
- data/vendor/cmock/vendor/unity/extras/fixture/readme.txt +9 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +436 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +83 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +51 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +47 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/Makefile +75 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +22 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +39 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +543 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +57 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +57 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/cmock/vendor/unity/release/build.info +2 -0
- data/vendor/cmock/vendor/unity/release/version.info +2 -0
- data/vendor/cmock/vendor/unity/src/unity.c +1572 -0
- data/vendor/cmock/vendor/unity/src/unity.h +503 -0
- data/vendor/cmock/vendor/unity/src/unity_internals.h +924 -0
- data/vendor/cmock/vendor/unity/test/Makefile +68 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +61 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +57 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.c +55 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_head1.h +15 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +80 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +76 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.c +75 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_head1.h +13 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +77 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +89 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +90 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +67 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +70 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +58 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +67 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +70 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +71 -0
- data/vendor/cmock/vendor/unity/test/rakefile +125 -0
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +260 -0
- data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +78 -0
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +78 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +49 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +50 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +47 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +59 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc_manual_math.yml +47 -0
- data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +101 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +90 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +80 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +80 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +94 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +84 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +95 -0
- data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +86 -0
- data/vendor/cmock/vendor/unity/test/testdata/CException.h +11 -0
- data/vendor/cmock/vendor/unity/test/testdata/Defs.h +8 -0
- data/vendor/cmock/vendor/unity/test/testdata/cmock.h +14 -0
- data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +13 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +186 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +70 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +195 -0
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1252 -0
- data/vendor/cmock/vendor/unity/test/tests/testparameterized.c +113 -0
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +5371 -0
- data/vendor/unity/auto/generate_test_runner.rb +30 -10
- data/vendor/unity/auto/parse_output.rb +212 -109
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +9 -10
- data/vendor/unity/docs/UnityAssertionsReference.md +11 -2
- data/vendor/unity/docs/UnityConfigurationGuide.md +90 -55
- data/vendor/unity/docs/UnityGettingStartedGuide.md +6 -5
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +23 -5
- data/vendor/unity/examples/unity_config.h +8 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.c +4 -0
- data/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +2 -2
- data/vendor/unity/release/build.info +1 -1
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +64 -57
- data/vendor/unity/src/unity.h +111 -7
- data/vendor/unity/src/unity_internals.h +173 -73
- data/vendor/unity/test/Makefile +5 -1
- data/vendor/unity/test/testdata/testRunnerGenerator.c +4 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +4 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +4 -1
- data/vendor/unity/test/tests/testparameterized.c +5 -2
- data/vendor/unity/test/tests/testunity.c +34 -0
- metadata +150 -2
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
---
|
|
2
|
+
:source:
|
|
3
|
+
:path: some/place
|
|
4
|
+
:file: test_example.c
|
|
5
|
+
:successes:
|
|
6
|
+
- :test: test_one
|
|
7
|
+
:line: 257
|
|
8
|
+
:message: ''
|
|
9
|
+
- :test: test_two
|
|
10
|
+
:line: 269
|
|
11
|
+
:message: ''
|
|
12
|
+
:failures: []
|
|
13
|
+
:ignores: []
|
|
14
|
+
:counts:
|
|
15
|
+
:total: 2
|
|
16
|
+
:passed: 2
|
|
17
|
+
:failed: 0
|
|
18
|
+
:ignored: 0
|
|
19
|
+
:stdout:
|
|
20
|
+
- Verbose output one
|
|
21
|
+
- Verbous output two
|
|
22
|
+
:time: 0.01234
|
|
@@ -30,11 +30,32 @@ describe "Ceedling" do
|
|
|
30
30
|
it { can_test_projects_with_success }
|
|
31
31
|
it { can_test_projects_with_fail }
|
|
32
32
|
it { can_test_projects_with_compile_error }
|
|
33
|
+
it { uses_raw_output_report_plugin }
|
|
33
34
|
it { can_use_the_module_plugin }
|
|
35
|
+
it { can_use_the_module_plugin_path_extension }
|
|
36
|
+
it { can_use_the_module_plugin_with_include_path }
|
|
34
37
|
it { handles_creating_the_same_module_twice_using_the_module_plugin }
|
|
35
38
|
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin }
|
|
39
|
+
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin_path_extension }
|
|
36
40
|
end
|
|
37
41
|
|
|
42
|
+
describe "deployed in a project's `vendor` directory." do
|
|
43
|
+
before do
|
|
44
|
+
@c.with_context do
|
|
45
|
+
`bundle exec ruby -S ceedling new --with-ignore #{@proj_name} 2>&1`
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
it { can_create_projects }
|
|
50
|
+
it { has_an_ignore }
|
|
51
|
+
it { contains_a_vendor_directory }
|
|
52
|
+
it { contains_documentation }
|
|
53
|
+
it { can_test_projects_with_success }
|
|
54
|
+
it { can_use_the_module_plugin }
|
|
55
|
+
end
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
38
59
|
describe "deployed in a project's `vendor` directory without docs." do
|
|
39
60
|
before do
|
|
40
61
|
@c.with_context do
|
|
@@ -51,8 +72,11 @@ describe "Ceedling" do
|
|
|
51
72
|
it { can_test_projects_with_fail }
|
|
52
73
|
it { can_test_projects_with_compile_error }
|
|
53
74
|
it { can_use_the_module_plugin }
|
|
75
|
+
it { can_use_the_module_plugin_path_extension }
|
|
76
|
+
it { can_use_the_module_plugin_with_include_path }
|
|
54
77
|
it { handles_creating_the_same_module_twice_using_the_module_plugin }
|
|
55
78
|
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin }
|
|
79
|
+
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin_path_extension }
|
|
56
80
|
end
|
|
57
81
|
|
|
58
82
|
describe "ugrade a project's `vendor` directory" do
|
|
@@ -71,8 +95,11 @@ describe "Ceedling" do
|
|
|
71
95
|
it { can_test_projects_with_fail }
|
|
72
96
|
it { can_test_projects_with_compile_error }
|
|
73
97
|
it { can_use_the_module_plugin }
|
|
98
|
+
it { can_use_the_module_plugin_path_extension }
|
|
99
|
+
it { can_use_the_module_plugin_with_include_path }
|
|
74
100
|
it { handles_creating_the_same_module_twice_using_the_module_plugin }
|
|
75
101
|
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin }
|
|
102
|
+
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin_path_extension }
|
|
76
103
|
|
|
77
104
|
it { can_upgrade_projects }
|
|
78
105
|
it { contains_a_vendor_directory }
|
|
@@ -82,8 +109,11 @@ describe "Ceedling" do
|
|
|
82
109
|
it { can_test_projects_with_fail }
|
|
83
110
|
it { can_test_projects_with_compile_error }
|
|
84
111
|
it { can_use_the_module_plugin }
|
|
112
|
+
it { can_use_the_module_plugin_path_extension }
|
|
113
|
+
it { can_use_the_module_plugin_with_include_path }
|
|
85
114
|
it { handles_creating_the_same_module_twice_using_the_module_plugin }
|
|
86
115
|
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin }
|
|
116
|
+
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin_path_extension }
|
|
87
117
|
end
|
|
88
118
|
|
|
89
119
|
describe "deployed as a gem" do
|
|
@@ -101,8 +131,11 @@ describe "Ceedling" do
|
|
|
101
131
|
it { can_test_projects_with_fail }
|
|
102
132
|
it { can_test_projects_with_compile_error }
|
|
103
133
|
it { can_use_the_module_plugin }
|
|
134
|
+
it { can_use_the_module_plugin_path_extension }
|
|
135
|
+
it { can_use_the_module_plugin_with_include_path }
|
|
104
136
|
it { handles_creating_the_same_module_twice_using_the_module_plugin }
|
|
105
137
|
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin }
|
|
138
|
+
it { handles_destroying_a_module_that_does_not_exist_using_the_module_plugin_path_extension }
|
|
106
139
|
end
|
|
107
140
|
|
|
108
141
|
describe "command: `ceedling examples`" do
|
data/vendor/cmock/README.md
CHANGED
|
@@ -7,17 +7,18 @@ Getting Started
|
|
|
7
7
|
================
|
|
8
8
|
|
|
9
9
|
If you're using Ceedling, there is no need to install CMock. It will handle it for you.
|
|
10
|
-
For everyone else, the simplest way is to grab it off github. You can also download it
|
|
10
|
+
For everyone else, the simplest way is to grab it off github. You can also download it
|
|
11
11
|
as a zip if you prefer. The Github method looks something like this:
|
|
12
12
|
|
|
13
13
|
> git clone --recursive https://github.com/throwtheswitch/cmock.git
|
|
14
14
|
> cd cmock
|
|
15
15
|
> bundle install # Ensures you have all RubyGems needed
|
|
16
|
-
|
|
16
|
+
|
|
17
17
|
If you plan to help with the development of CMock (or just want to verify that it can
|
|
18
18
|
perform its self tests on your system) then you can enter the test directory and then
|
|
19
19
|
ask it to test:
|
|
20
|
-
|
|
20
|
+
|
|
21
|
+
> cd test
|
|
21
22
|
> rake # Run all CMock self tests
|
|
22
23
|
|
|
23
24
|
API Documentation
|
|
@@ -597,7 +597,7 @@ Examples
|
|
|
597
597
|
|
|
598
598
|
You can look in the [examples directory](/examples/) for a couple of examples on how
|
|
599
599
|
you might tool CMock into your build process. You may also want to consider
|
|
600
|
-
using [Ceedling](https://throwtheswitch.org/
|
|
600
|
+
using [Ceedling](https://throwtheswitch.org/ceedling). Please note that
|
|
601
601
|
these examples are meant to show how the build process works. They have
|
|
602
602
|
failing tests ON PURPOSE to show what that would look like. Don't be alarmed. ;)
|
|
603
603
|
|
|
@@ -120,6 +120,8 @@ class CMockConfig
|
|
|
120
120
|
'UINT32' => 'HEX32',
|
|
121
121
|
'UINT32_T' => 'HEX32',
|
|
122
122
|
'void*' => 'HEX8_ARRAY',
|
|
123
|
+
'void const*' => 'HEX8_ARRAY',
|
|
124
|
+
'const void*' => 'HEX8_ARRAY',
|
|
123
125
|
'unsigned short' => 'HEX16',
|
|
124
126
|
'uint16' => 'HEX16',
|
|
125
127
|
'uint16_t' => 'HEX16',
|
|
@@ -131,6 +133,8 @@ class CMockConfig
|
|
|
131
133
|
'UINT8' => 'HEX8',
|
|
132
134
|
'UINT8_T' => 'HEX8',
|
|
133
135
|
'char*' => 'STRING',
|
|
136
|
+
'char const*' => 'STRING',
|
|
137
|
+
'const char*' => 'STRING',
|
|
134
138
|
'pCHAR' => 'STRING',
|
|
135
139
|
'cstring' => 'STRING',
|
|
136
140
|
'CSTRING' => 'STRING',
|
|
@@ -103,7 +103,9 @@ class CMockGenerator
|
|
|
103
103
|
file << "\n"
|
|
104
104
|
file << "/* Ignore the following warnings, since we are copying code */\n"
|
|
105
105
|
file << "#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n"
|
|
106
|
+
file << "#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n"
|
|
106
107
|
file << "#pragma GCC diagnostic push\n"
|
|
108
|
+
file << "#endif\n"
|
|
107
109
|
file << "#if !defined(__clang__)\n"
|
|
108
110
|
file << "#pragma GCC diagnostic ignored \"-Wpragmas\"\n"
|
|
109
111
|
file << "#endif\n"
|
|
@@ -128,8 +130,10 @@ class CMockGenerator
|
|
|
128
130
|
def create_mock_header_footer(header)
|
|
129
131
|
header << "\n"
|
|
130
132
|
header << "#if defined(__GNUC__) && !defined(__ICC) && !defined(__TMS470__)\n"
|
|
133
|
+
header << "#if __GNUC__ > 4 || (__GNUC__ == 4 && (__GNUC_MINOR__ > 6 || (__GNUC_MINOR__ == 6 && __GNUC_PATCHLEVEL__ > 0)))\n"
|
|
131
134
|
header << "#pragma GCC diagnostic pop\n"
|
|
132
135
|
header << "#endif\n"
|
|
136
|
+
header << "#endif\n"
|
|
133
137
|
header << "\n"
|
|
134
138
|
header << "#endif\n"
|
|
135
139
|
end
|
|
@@ -247,10 +251,9 @@ class CMockGenerator
|
|
|
247
251
|
file << " if (cmock_call_instance->CallOrder < GlobalVerifyOrder)\n"
|
|
248
252
|
file << " UNITY_TEST_FAIL(cmock_line, CMockStringCalledLate);\n"
|
|
249
253
|
end
|
|
250
|
-
return_type = function[:return][:const?] ? "(const #{function[:return][:type]})" : ((function[:return][:type] =~ /cmock/) ? "(#{function[:return][:type]})" : '')
|
|
251
254
|
file << @plugins.run(:mock_implementation, function)
|
|
252
255
|
file << " UNITY_CLR_DETAILS();\n"
|
|
253
|
-
file << " return
|
|
256
|
+
file << " return cmock_call_instance->ReturnVal;\n" unless (function[:return][:void?])
|
|
254
257
|
file << "}\n\n"
|
|
255
258
|
end
|
|
256
259
|
|
|
@@ -27,8 +27,8 @@ class CMockGeneratorPluginArray
|
|
|
27
27
|
return nil unless function[:contains_ptr?]
|
|
28
28
|
args_call = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : "#{m[:name]}"}.join(', ')
|
|
29
29
|
args_string = function[:args].map do |m|
|
|
30
|
-
|
|
31
|
-
m[:ptr?] ? "#{
|
|
30
|
+
type = @utils.arg_type_with_const(m)
|
|
31
|
+
m[:ptr?] ? "#{type} #{m[:name]}, int #{m[:name]}_Depth" : "#{type} #{m[:name]}"
|
|
32
32
|
end.join(', ')
|
|
33
33
|
if (function[:return][:void?])
|
|
34
34
|
return "#define #{function[:name]}_ExpectWithArray(#{args_call}) #{function[:name]}_CMockExpectWithArray(__LINE__, #{args_call})\n" +
|
|
@@ -44,8 +44,8 @@ class CMockGeneratorPluginArray
|
|
|
44
44
|
lines = []
|
|
45
45
|
func_name = function[:name]
|
|
46
46
|
args_string = function[:args].map do |m|
|
|
47
|
-
|
|
48
|
-
m[:ptr?] ? "#{
|
|
47
|
+
type = @utils.arg_type_with_const(m)
|
|
48
|
+
m[:ptr?] ? "#{type} #{m[:name]}, int #{m[:name]}_Depth" : "#{type} #{m[:name]}"
|
|
49
49
|
end.join(', ')
|
|
50
50
|
call_string = function[:args].map{|m| m[:ptr?] ? "#{m[:name]}, #{m[:name]}_Depth" : m[:name]}.join(', ')
|
|
51
51
|
if (function[:return][:void?])
|
|
@@ -33,7 +33,7 @@ class CMockGeneratorPluginCallback
|
|
|
33
33
|
|
|
34
34
|
def mock_function_declarations(function)
|
|
35
35
|
func_name = function[:name]
|
|
36
|
-
return_type = function[:return][:
|
|
36
|
+
return_type = function[:return][:type]
|
|
37
37
|
style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2)
|
|
38
38
|
styles = [ "void", "int cmock_num_calls", function[:args_string], "#{function[:args_string]}, int cmock_num_calls" ]
|
|
39
39
|
"typedef #{return_type} (* CMOCK_#{func_name}_CALLBACK)(#{styles[style]});\nvoid #{func_name}_StubWithCallback(CMOCK_#{func_name}_CALLBACK Callback);\n"
|
|
@@ -41,7 +41,6 @@ class CMockGeneratorPluginCallback
|
|
|
41
41
|
|
|
42
42
|
def mock_implementation_for_callbacks_after_arg_check(function)
|
|
43
43
|
func_name = function[:name]
|
|
44
|
-
return_cast = function[:return][:const?] ? "(#{function[:return][:type]})" : ""
|
|
45
44
|
style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4)
|
|
46
45
|
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" +
|
|
47
46
|
case(style)
|
|
@@ -49,16 +48,15 @@ class CMockGeneratorPluginCallback
|
|
|
49
48
|
when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
|
|
50
49
|
when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
|
|
51
50
|
when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
|
|
52
|
-
when 4 then " cmock_call_instance->ReturnVal =
|
|
53
|
-
when 5 then " cmock_call_instance->ReturnVal =
|
|
54
|
-
when 6 then " cmock_call_instance->ReturnVal =
|
|
55
|
-
when 7 then " cmock_call_instance->ReturnVal =
|
|
51
|
+
when 4 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer();\n }\n"
|
|
52
|
+
when 5 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
|
|
53
|
+
when 6 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
|
|
54
|
+
when 7 then " cmock_call_instance->ReturnVal = Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
|
|
56
55
|
end
|
|
57
56
|
end
|
|
58
57
|
|
|
59
58
|
def mock_implementation_for_callbacks_without_arg_check(function)
|
|
60
59
|
func_name = function[:name]
|
|
61
|
-
return_cast = function[:return][:const?] ? "(#{function[:return][:type]})" : ""
|
|
62
60
|
style = (@include_count ? 1 : 0) | (function[:args].empty? ? 0 : 2) | (function[:return][:void?] ? 0 : 4)
|
|
63
61
|
" if (Mock.#{func_name}_CallbackFunctionPointer != NULL)\n {\n" +
|
|
64
62
|
case(style)
|
|
@@ -66,10 +64,10 @@ class CMockGeneratorPluginCallback
|
|
|
66
64
|
when 1 then " Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n return;\n }\n"
|
|
67
65
|
when 2 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n return;\n }\n"
|
|
68
66
|
when 3 then " Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n return;\n }\n"
|
|
69
|
-
when 4 then " return
|
|
70
|
-
when 5 then " return
|
|
71
|
-
when 6 then " return
|
|
72
|
-
when 7 then " return
|
|
67
|
+
when 4 then " return Mock.#{func_name}_CallbackFunctionPointer();\n }\n"
|
|
68
|
+
when 5 then " return Mock.#{func_name}_CallbackFunctionPointer(Mock.#{func_name}_CallbackCalls++);\n }\n"
|
|
69
|
+
when 6 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')});\n }\n"
|
|
70
|
+
when 7 then " return Mock.#{func_name}_CallbackFunctionPointer(#{function[:args].map{|m| m[:name]}.join(', ')}, Mock.#{func_name}_CallbackCalls++);\n }\n"
|
|
73
71
|
end
|
|
74
72
|
end
|
|
75
73
|
|
|
@@ -41,7 +41,6 @@ class CMockGeneratorPluginCexception
|
|
|
41
41
|
|
|
42
42
|
def mock_interfaces(function)
|
|
43
43
|
arg_insert = (function[:args_string] == "void") ? "" : "#{function[:args_string]}, "
|
|
44
|
-
call_string = function[:args].map{|m| m[:name]}.join(', ')
|
|
45
44
|
[ "void #{function[:name]}_CMockExpectAndThrow(UNITY_LINE_TYPE cmock_line, #{arg_insert}CEXCEPTION_T cmock_to_throw)\n{\n",
|
|
46
45
|
@utils.code_add_base_expectation(function[:name]),
|
|
47
46
|
@utils.code_call_argument_loader(function),
|
|
@@ -40,10 +40,9 @@ class CMockGeneratorPluginIgnore
|
|
|
40
40
|
lines << " return;\n }\n"
|
|
41
41
|
else
|
|
42
42
|
retval = function[:return].merge( { :name => "cmock_call_instance->ReturnVal"} )
|
|
43
|
-
|
|
44
|
-
lines << " if (cmock_call_instance == NULL)\n return #{return_type}Mock.#{function[:name]}_FinalReturn;\n"
|
|
43
|
+
lines << " if (cmock_call_instance == NULL)\n return Mock.#{function[:name]}_FinalReturn;\n"
|
|
45
44
|
lines << " " + @utils.code_assign_argument_quickly("Mock.#{function[:name]}_FinalReturn", retval) unless (retval[:void?])
|
|
46
|
-
lines << " return
|
|
45
|
+
lines << " return cmock_call_instance->ReturnVal;\n }\n"
|
|
47
46
|
end
|
|
48
47
|
lines
|
|
49
48
|
end
|
|
@@ -29,14 +29,12 @@ class CMockGeneratorPluginIgnoreArg
|
|
|
29
29
|
lines = []
|
|
30
30
|
func_name = function[:name]
|
|
31
31
|
function[:args].each do |arg|
|
|
32
|
-
|
|
33
|
-
arg_type = arg[:type]
|
|
34
|
-
lines << "void #{function[:name]}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
|
|
32
|
+
lines << "void #{func_name}_CMockIgnoreArg_#{arg[:name]}(UNITY_LINE_TYPE cmock_line)\n"
|
|
35
33
|
lines << "{\n"
|
|
36
34
|
lines << " CMOCK_#{func_name}_CALL_INSTANCE* cmock_call_instance = " +
|
|
37
35
|
"(CMOCK_#{func_name}_CALL_INSTANCE*)CMock_Guts_GetAddressFor(CMock_Guts_MemEndOfChain(Mock.#{func_name}_CallInstance));\n"
|
|
38
36
|
lines << " UNITY_TEST_ASSERT_NOT_NULL(cmock_call_instance, cmock_line, CMockStringIgnPreExp);\n"
|
|
39
|
-
lines << " cmock_call_instance->IgnoreArg_#{
|
|
37
|
+
lines << " cmock_call_instance->IgnoreArg_#{arg[:name]} = 1;\n"
|
|
40
38
|
lines << "}\n\n"
|
|
41
39
|
end
|
|
42
40
|
lines
|
|
@@ -40,7 +40,6 @@ class CMockGeneratorPluginReturnThruPtr
|
|
|
40
40
|
func_name = function[:name]
|
|
41
41
|
function[:args].each do |arg|
|
|
42
42
|
arg_name = arg[:name]
|
|
43
|
-
arg_type = arg[:type]
|
|
44
43
|
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
|
45
44
|
lines << "void #{func_name}_CMockReturnMemThruPtr_#{arg_name}(UNITY_LINE_TYPE cmock_line, #{arg[:type]} #{arg_name}, int cmock_size)\n"
|
|
46
45
|
lines << "{\n"
|
|
@@ -60,7 +59,6 @@ class CMockGeneratorPluginReturnThruPtr
|
|
|
60
59
|
lines = []
|
|
61
60
|
function[:args].each do |arg|
|
|
62
61
|
arg_name = arg[:name]
|
|
63
|
-
arg_type = arg[:type]
|
|
64
62
|
if (@utils.ptr_or_str?(arg[:type]) and not arg[:const?])
|
|
65
63
|
lines << " if (cmock_call_instance->ReturnThruPtr_#{arg_name}_Used)\n"
|
|
66
64
|
lines << " {\n"
|
|
@@ -22,6 +22,19 @@ class CMockGeneratorUtils
|
|
|
22
22
|
@helpers = helpers
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
def self.arg_type_with_const(arg)
|
|
26
|
+
# Restore any "const" that was removed in header parsing
|
|
27
|
+
if arg[:type].include?('*')
|
|
28
|
+
arg[:const_ptr?] ? "#{arg[:type]} const" : arg[:type]
|
|
29
|
+
else
|
|
30
|
+
arg[:const?] ? "const #{arg[:type]}" : arg[:type]
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
def arg_type_with_const(arg)
|
|
35
|
+
self.class.arg_type_with_const(arg)
|
|
36
|
+
end
|
|
37
|
+
|
|
25
38
|
def code_verify_an_arg_expectation(function, arg)
|
|
26
39
|
if (@arrays)
|
|
27
40
|
case(@ptr_handling)
|
|
@@ -58,7 +71,7 @@ class CMockGeneratorUtils
|
|
|
58
71
|
|
|
59
72
|
def code_assign_argument_quickly(dest, arg)
|
|
60
73
|
if (arg[:ptr?] or @treat_as.include?(arg[:type]))
|
|
61
|
-
" #{dest} = #{arg[:
|
|
74
|
+
" #{dest} = #{arg[:name]};\n"
|
|
62
75
|
else
|
|
63
76
|
" memcpy(&#{dest}, &#{arg[:name]}, sizeof(#{arg[:type]}));\n"
|
|
64
77
|
end
|
|
@@ -68,8 +81,8 @@ class CMockGeneratorUtils
|
|
|
68
81
|
if (function[:args_string] != "void")
|
|
69
82
|
if (@arrays)
|
|
70
83
|
args_string = function[:args].map do |m|
|
|
71
|
-
|
|
72
|
-
m[:ptr?] ? "#{
|
|
84
|
+
type = arg_type_with_const(m)
|
|
85
|
+
m[:ptr?] ? "#{type} #{m[:name]}, int #{m[:name]}_Depth" : "#{type} #{m[:name]}"
|
|
73
86
|
end.join(', ')
|
|
74
87
|
"void CMockExpectParameters_#{function[:name]}(CMOCK_#{function[:name]}_CALL_INSTANCE* cmock_call_instance, #{args_string})\n{\n" +
|
|
75
88
|
function[:args].inject("") { |all, arg| all + code_add_an_arg_expectation(arg, (arg[:ptr?] ? "#{arg[:name]}_Depth" : 1) ) } +
|
|
@@ -6,12 +6,13 @@
|
|
|
6
6
|
|
|
7
7
|
class CMockHeaderParser
|
|
8
8
|
|
|
9
|
-
attr_accessor :funcs, :c_attributes, :treat_as_void, :treat_externs
|
|
9
|
+
attr_accessor :funcs, :c_attr_noconst, :c_attributes, :treat_as_void, :treat_externs
|
|
10
10
|
|
|
11
11
|
def initialize(cfg)
|
|
12
12
|
@funcs = []
|
|
13
13
|
@c_strippables = cfg.strippables
|
|
14
|
-
@
|
|
14
|
+
@c_attr_noconst = cfg.attributes.uniq - ['const']
|
|
15
|
+
@c_attributes = ['const'] + c_attr_noconst
|
|
15
16
|
@c_calling_conventions = cfg.c_calling_conventions.uniq
|
|
16
17
|
@treat_as_void = (['void'] + cfg.treat_as_void).uniq
|
|
17
18
|
@declaration_parse_matcher = /([\d\w\s\*\(\),\[\]]+??)\(([\d\w\s\*\(\),\.\[\]+-]*)\)$/m
|
|
@@ -139,16 +140,51 @@ class CMockHeaderParser
|
|
|
139
140
|
return funcs
|
|
140
141
|
end
|
|
141
142
|
|
|
143
|
+
def parse_type_and_name(arg)
|
|
144
|
+
# Split up words and remove known attributes. For pointer types, make sure
|
|
145
|
+
# to remove 'const' only when it applies to the pointer itself, not when it
|
|
146
|
+
# applies to the type pointed to. For non-pointer types, remove any
|
|
147
|
+
# occurrence of 'const'.
|
|
148
|
+
arg.gsub!(/(\w)\*/,'\1 *') # pull asterisks away from preceding word
|
|
149
|
+
arg.gsub!(/\*(\w)/,'* \1') # pull asterisks away from following word
|
|
150
|
+
arg_array = arg.split
|
|
151
|
+
arg_info = divine_ptr_and_const(arg)
|
|
152
|
+
arg_info[:name] = arg_array[-1]
|
|
153
|
+
|
|
154
|
+
attributes = arg.include?('*') ? @c_attr_noconst : @c_attributes
|
|
155
|
+
attr_array = []
|
|
156
|
+
type_array = []
|
|
157
|
+
|
|
158
|
+
arg_array[0..-2].each do |word|
|
|
159
|
+
if attributes.include?(word)
|
|
160
|
+
attr_array << word
|
|
161
|
+
elsif @c_calling_conventions.include?(word)
|
|
162
|
+
arg_info[:c_calling_convention] = word
|
|
163
|
+
else
|
|
164
|
+
type_array << word
|
|
165
|
+
end
|
|
166
|
+
end
|
|
167
|
+
|
|
168
|
+
if arg_info[:const_ptr?]
|
|
169
|
+
attr_array << 'const'
|
|
170
|
+
type_array.delete_at(type_array.rindex('const'))
|
|
171
|
+
end
|
|
172
|
+
|
|
173
|
+
arg_info[:modifier] = attr_array.join(' ')
|
|
174
|
+
arg_info[:type] = type_array.join(' ').gsub(/\s+\*/,'*') # remove space before asterisks
|
|
175
|
+
return arg_info
|
|
176
|
+
end
|
|
177
|
+
|
|
142
178
|
def parse_args(arg_list)
|
|
143
179
|
args = []
|
|
144
180
|
arg_list.split(',').each do |arg|
|
|
145
181
|
arg.strip!
|
|
146
182
|
return args if (arg =~ /^\s*((\.\.\.)|(void))\s*$/) # we're done if we reach void by itself or ...
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
183
|
+
|
|
184
|
+
arg_info = parse_type_and_name(arg)
|
|
185
|
+
arg_info.delete(:modifier) # don't care about this
|
|
186
|
+
arg_info.delete(:c_calling_convention) # don't care about this
|
|
187
|
+
args << arg_info
|
|
152
188
|
end
|
|
153
189
|
return args
|
|
154
190
|
end
|
|
@@ -227,35 +263,24 @@ class CMockHeaderParser
|
|
|
227
263
|
args = regex_match[2].strip
|
|
228
264
|
|
|
229
265
|
#process function attributes, return type, and name
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
decl[:name] = descriptors[-1] #snag name as last array item
|
|
237
|
-
|
|
238
|
-
#build attribute and return type strings
|
|
239
|
-
decl[:modifier] = []
|
|
240
|
-
rettype = []
|
|
241
|
-
full_retval = descriptors[0..-2].join(' ')
|
|
242
|
-
descriptors[0..-2].each do |word|
|
|
243
|
-
if @c_attributes.include?(word)
|
|
244
|
-
decl[:modifier] << word
|
|
245
|
-
elsif @c_calling_conventions.include?(word)
|
|
246
|
-
decl[:c_calling_convention] = word
|
|
247
|
-
else
|
|
248
|
-
rettype << word
|
|
249
|
-
end
|
|
266
|
+
parsed = parse_type_and_name(regex_match[1])
|
|
267
|
+
|
|
268
|
+
decl[:name] = parsed[:name]
|
|
269
|
+
decl[:modifier] = parsed[:modifier]
|
|
270
|
+
unless parsed[:c_calling_convention].nil?
|
|
271
|
+
decl[:c_calling_convention] = parsed[:c_calling_convention]
|
|
250
272
|
end
|
|
251
|
-
|
|
252
|
-
rettype =
|
|
273
|
+
|
|
274
|
+
rettype = parsed[:type]
|
|
253
275
|
rettype = 'void' if (@local_as_void.include?(rettype.strip))
|
|
254
|
-
decl[:return] = { :type
|
|
255
|
-
:name
|
|
256
|
-
:str
|
|
257
|
-
:void?
|
|
258
|
-
|
|
276
|
+
decl[:return] = { :type => rettype,
|
|
277
|
+
:name => 'cmock_to_return',
|
|
278
|
+
:str => "#{rettype} cmock_to_return",
|
|
279
|
+
:void? => (rettype == 'void'),
|
|
280
|
+
:ptr? => parsed[:ptr?],
|
|
281
|
+
:const? => parsed[:const?],
|
|
282
|
+
:const_ptr? => parsed[:const_ptr?]
|
|
283
|
+
}
|
|
259
284
|
|
|
260
285
|
#remove default argument statements from mock definitions
|
|
261
286
|
args.gsub!(/=\s*[a-zA-Z0-9_\.]+\s*/, ' ')
|