ceedling 0.25.0 → 0.27.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/assets/project_as_gem.yml +13 -0
- data/assets/project_with_guts.yml +13 -0
- data/bin/ceedling +91 -67
- data/docs/CeedlingPacket.md +61 -23
- data/docs/CeedlingPacket.odt +0 -0
- data/docs/CeedlingPacket.pdf +0 -0
- data/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/examples/temp_sensor/test/TestTemperatureCalculator.c +4 -1
- data/lib/ceedling/configurator.rb +14 -1
- data/lib/ceedling/configurator_builder.rb +2 -1
- data/lib/ceedling/configurator_validator.rb +12 -3
- data/lib/ceedling/constants.rb +3 -1
- data/lib/ceedling/defaults.rb +12 -1
- data/lib/ceedling/file_finder.rb +3 -0
- data/lib/ceedling/file_path_utils.rb +1 -1
- data/lib/ceedling/file_wrapper.rb +4 -4
- data/lib/ceedling/generator.rb +12 -3
- data/lib/ceedling/preprocessinator_helper.rb +5 -5
- data/lib/ceedling/preprocessinator_includes_handler.rb +10 -1
- data/lib/ceedling/project_config_manager.rb +1 -2
- data/lib/ceedling/project_file_loader.rb +27 -9
- data/lib/ceedling/rakefile.rb +6 -6
- data/lib/ceedling/release_invoker.rb +21 -6
- data/lib/ceedling/rules_release.rake +9 -5
- data/lib/ceedling/rules_tests.rake +6 -1
- data/lib/ceedling/setupinator.rb +1 -0
- data/lib/ceedling/tasks_base.rake +3 -0
- data/lib/ceedling/tasks_filesystem.rake +10 -7
- data/lib/ceedling/tasks_release.rake +3 -1
- data/lib/ceedling/test_includes_extractor.rb +16 -12
- data/lib/ceedling/test_invoker.rb +40 -0
- data/lib/ceedling/version.rb +3 -3
- data/lib/ceedling/version.rb.erb +1 -1
- data/plugins/command_hooks/lib/command_hooks.rb +1 -1
- data/plugins/fake_function_framework/examples/fff_example/src/bar.h +1 -0
- data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +1 -0
- data/plugins/fake_function_framework/lib/fff_mock_generator.rb +4 -0
- data/plugins/fake_function_framework/spec/{fff_mock_generator_spec.rb → fff_mock_header_generator_spec.rb} +34 -194
- data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +149 -0
- data/plugins/fake_function_framework/spec/header_generator.rb +51 -0
- data/plugins/junit_tests_report/lib/junit_tests_report.rb +115 -0
- data/plugins/subprojects/README.md +63 -0
- data/plugins/subprojects/config/defaults.yml +33 -0
- data/plugins/subprojects/lib/subprojects.rb +92 -0
- data/plugins/subprojects/subprojects.rake +78 -0
- data/spec/preprocessinator_includes_handler_spec.rb +15 -5
- data/spec/spec_helper.rb +2 -2
- data/spec/spec_system_helper.rb +49 -1
- data/spec/system/deployment_spec.rb +29 -0
- data/vendor/c_exception/README.md +8 -2
- data/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
- data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/c_exception/vendor/unity/README.md +19 -10
- data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/c_exception/vendor/unity/src/unity.c +396 -330
- data/vendor/c_exception/vendor/unity/src/unity.h +50 -4
- data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/c_exception/vendor/unity/test/Makefile +17 -17
- data/vendor/c_exception/vendor/unity/test/rakefile +63 -3
- data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
- data/vendor/cmock/README.md +10 -1
- data/vendor/cmock/config/test_environment.rb +7 -7
- data/vendor/cmock/docs/CMock_Summary.md +325 -128
- data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/examples/make_example/Makefile +2 -2
- data/vendor/cmock/examples/temp_sensor/gcc.yml +5 -4
- data/vendor/cmock/examples/temp_sensor/iar_v4.yml +5 -4
- data/vendor/cmock/examples/temp_sensor/iar_v5.yml +5 -4
- data/vendor/cmock/examples/temp_sensor/rakefile.rb +11 -1
- data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +12 -10
- data/vendor/cmock/lib/cmock.rb +0 -3
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +6 -2
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -1
- data/vendor/cmock/lib/cmock_header_parser.rb +5 -6
- data/vendor/cmock/release/version.info +1 -1
- data/vendor/cmock/scripts/create_makefile.rb +4 -2
- data/vendor/cmock/scripts/test_summary.rb +17 -9
- data/vendor/cmock/src/cmock.c +1 -0
- data/vendor/cmock/src/cmock.h +1 -1
- data/vendor/cmock/src/cmock_internals.h +14 -1
- data/vendor/cmock/test/c/TestCMockC.yml +4 -4
- data/vendor/cmock/test/c/TestCMockCDynamic.yml +4 -4
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_FLASH.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_RAM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_SIM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_FLASH.xcl +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_RAM.xcl +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/ioat91sam7x256.ddf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.dep +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewd +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewp +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.eww +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X-EK.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.inc +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.rdf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.tcl +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256_inc.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/ioat91sam7x256.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/lib_AT91SAM7X256.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.cspy.bat +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dbgdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dni +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.wsdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup.s79 +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup_SAM7.c +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_FLASH.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_RAM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_SIM.mac +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_FLASH.icf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_RAM.icf +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.dep +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewd +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewp +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.eww +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X-EK.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X256_inc.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/lib_AT91SAM7X256.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/project.h +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dni +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.cspy.bat +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dbgdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dni +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.wsdt +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_Binary.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_RAM_Debug.jlink +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup.s +0 -0
- data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup_SAM7.c +0 -0
- data/vendor/cmock/{Rakefile → test/rakefile} +9 -9
- data/vendor/cmock/{rakefile_helper.rb → test/rakefile_helper.rb} +13 -13
- data/vendor/cmock/test/system/test_compilation/config.yml +4 -4
- data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +2 -0
- data/vendor/cmock/{targets → test/targets}/clang_strict.yml +11 -11
- data/vendor/cmock/{targets → test/targets}/gcc.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/gcc_64.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/gcc_tiny.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/iar_arm_v4.yml +9 -9
- data/vendor/cmock/{targets → test/targets}/iar_arm_v5.yml +10 -10
- data/vendor/cmock/test/test_helper.rb +4 -8
- data/vendor/cmock/test/unit/cmock_config_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +3 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +15 -2
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +6 -10
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +1 -1
- data/vendor/cmock/vendor/c_exception/README.md +8 -2
- data/vendor/cmock/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
- data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +19 -10
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +396 -330
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +50 -4
- data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +17 -17
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +63 -3
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
- data/vendor/cmock/vendor/unity/README.md +19 -10
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/cmock/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/cmock/vendor/unity/release/version.info +1 -1
- data/vendor/cmock/vendor/unity/src/unity.c +396 -330
- data/vendor/cmock/vendor/unity/src/unity.h +50 -4
- data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/cmock/vendor/unity/test/Makefile +17 -17
- data/vendor/cmock/vendor/unity/test/rakefile +63 -3
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +108 -105
- 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 +0 -6
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/cmock/vendor/unity/test/tests/testunity.c +1338 -151
- data/vendor/deep_merge/Rakefile +1 -1
- data/vendor/unity/README.md +19 -10
- data/vendor/unity/auto/colour_prompt.rb +67 -64
- data/vendor/unity/auto/colour_reporter.rb +20 -20
- data/vendor/unity/auto/generate_module.rb +149 -142
- data/vendor/unity/auto/generate_test_runner.rb +234 -232
- data/vendor/unity/auto/parse_output.rb +220 -0
- data/vendor/unity/auto/stylize_as_junit.rb +108 -120
- data/vendor/unity/auto/test_file_filter.rb +11 -9
- data/vendor/unity/auto/type_sanitizer.rb +1 -3
- data/vendor/unity/auto/unity_test_summary.py +6 -2
- data/vendor/unity/auto/unity_test_summary.rb +45 -57
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
- data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
- data/vendor/unity/docs/UnityAssertionsReference.md +716 -0
- data/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
- data/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
- data/vendor/unity/examples/example_1/makefile +22 -17
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/unity/examples/example_2/makefile +16 -17
- data/vendor/unity/examples/example_3/rakefile.rb +15 -15
- data/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
- data/vendor/unity/examples/example_3/readme.txt +4 -10
- data/vendor/unity/examples/unity_config.h +14 -26
- data/vendor/unity/extras/fixture/rakefile.rb +12 -12
- data/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
- data/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
- data/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
- data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
- data/vendor/unity/release/version.info +1 -1
- data/vendor/unity/src/unity.c +396 -330
- data/vendor/unity/src/unity.h +50 -4
- data/vendor/unity/src/unity_internals.h +119 -84
- data/vendor/unity/test/Makefile +17 -17
- data/vendor/unity/test/rakefile +63 -3
- data/vendor/unity/test/rakefile_helper.rb +108 -105
- data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
- data/vendor/unity/test/targets/clang_file.yml +0 -6
- data/vendor/unity/test/targets/clang_strict.yml +1 -9
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
- data/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
- data/vendor/unity/test/tests/testunity.c +1338 -151
- metadata +102 -157
- data/test_graveyard/integration/paths.yml +0 -17
- data/test_graveyard/integration/paths_test.rb +0 -80
- data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +0 -75
- data/test_graveyard/integration/rake_rules_cmock_test.rb +0 -74
- data/test_graveyard/integration/rake_rules_preprocess_test.rb +0 -178
- data/test_graveyard/integration/rake_rules_test.rb +0 -268
- data/test_graveyard/integration/rake_tasks_test.rb +0 -103
- data/test_graveyard/integration_test_helper.rb +0 -34
- data/test_graveyard/rakefile_rules.rb +0 -10
- data/test_graveyard/rakefile_rules_aux_dependencies.rb +0 -10
- data/test_graveyard/rakefile_rules_cmock.rb +0 -10
- data/test_graveyard/rakefile_rules_preprocess.rb +0 -10
- data/test_graveyard/rakefile_tasks.rb +0 -10
- data/test_graveyard/system/file_system_dependencies.yml +0 -20
- data/test_graveyard/system/file_system_kitchen_sink.yml +0 -20
- data/test_graveyard/system/file_system_mocks.yml +0 -20
- data/test_graveyard/system/file_system_preprocess.yml +0 -20
- data/test_graveyard/system/file_system_simple.yml +0 -20
- data/test_graveyard/system/file_system_test.rb +0 -78
- data/test_graveyard/system/mocks/include/a_file.h +0 -2
- data/test_graveyard/system/mocks/include/other_stuff.h +0 -2
- data/test_graveyard/system/mocks/include/stuff.h +0 -3
- data/test_graveyard/system/mocks/source/a_file.c +0 -9
- data/test_graveyard/system/mocks/test/test_a_file.c +0 -41
- data/test_graveyard/system/mocks/test/test_no_file.c +0 -14
- data/test_graveyard/system/project_mocks.yml +0 -43
- data/test_graveyard/system/project_mocks_test.rb +0 -38
- data/test_graveyard/system/project_simple.yml +0 -36
- data/test_graveyard/system/project_simple_test.rb +0 -39
- data/test_graveyard/system/rule_mocks_test.rb +0 -44
- data/test_graveyard/system/rule_runners_test.rb +0 -44
- data/test_graveyard/system/simple/include/other_stuff.h +0 -2
- data/test_graveyard/system/simple/include/stuff.h +0 -3
- data/test_graveyard/system/simple/source/other_stuff.c +0 -6
- data/test_graveyard/system/simple/source/stuff.c +0 -7
- data/test_graveyard/system/simple/test/test_other_stuff.c +0 -30
- data/test_graveyard/system/simple/test/test_stuff.c +0 -51
- data/test_graveyard/system_test_helper.rb +0 -73
- data/test_graveyard/test_helper.rb +0 -93
- data/test_graveyard/unit/busted/configurator_builder_test.rb +0 -569
- data/test_graveyard/unit/busted/configurator_helper_test.rb +0 -234
- data/test_graveyard/unit/busted/configurator_test.rb +0 -232
- data/test_graveyard/unit/busted/configurator_validator_test.rb +0 -169
- data/test_graveyard/unit/busted/deep_merge_fix_test.rb +0 -55
- data/test_graveyard/unit/busted/dependinator_test.rb +0 -129
- data/test_graveyard/unit/busted/file_finder_helper_test.rb +0 -45
- data/test_graveyard/unit/busted/file_finder_test.rb +0 -114
- data/test_graveyard/unit/busted/file_path_utils_test.rb +0 -97
- data/test_graveyard/unit/busted/file_system_utils_test.rb +0 -21
- data/test_graveyard/unit/busted/generator_test.rb +0 -187
- data/test_graveyard/unit/busted/generator_test_results_test.rb +0 -129
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +0 -475
- data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +0 -39
- data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +0 -156
- data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +0 -93
- data/test_graveyard/unit/busted/preprocessinator_test.rb +0 -57
- data/test_graveyard/unit/busted/project_file_loader_test.rb +0 -142
- data/test_graveyard/unit/busted/setupinator_test.rb +0 -45
- data/test_graveyard/unit/busted/streaminator_test.rb +0 -49
- data/test_graveyard/unit/busted/task_invoker_test.rb +0 -69
- data/test_graveyard/unit/busted/test_includes_extractor_test.rb +0 -111
- data/test_graveyard/unit/busted/test_invoker_helper_test.rb +0 -62
- data/test_graveyard/unit/busted/test_invoker_test.rb +0 -47
- data/test_graveyard/unit/busted/tool_executor_helper_test.rb +0 -100
- data/test_graveyard/unit/busted/tool_executor_test.rb +0 -351
- data/test_graveyard/unit/busted/verbosinator_test.rb +0 -65
- data/test_graveyard/unit/preprocessinator_extractor_test.rb +0 -731
- data/test_graveyard/unit_test_helper.rb +0 -16
- data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/cmock/docs/CMock Summary.odt +0 -0
- data/vendor/cmock/docs/CMock Summary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
- data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
- data/vendor/unity/auto/parseOutput.rb +0 -191
- data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
- data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
- data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
- data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
@@ -4,75 +4,70 @@
|
|
4
4
|
# [Released under MIT License. Please refer to license.txt for details]
|
5
5
|
# ==========================================
|
6
6
|
|
7
|
-
|
8
|
-
File.expand_path(File.join(File.dirname(__FILE__),'colour_prompt'))
|
7
|
+
File.expand_path(File.join(File.dirname(__FILE__), 'colour_prompt'))
|
9
8
|
|
10
9
|
class UnityTestRunnerGenerator
|
11
|
-
|
12
10
|
def initialize(options = nil)
|
13
11
|
@options = UnityTestRunnerGenerator.default_options
|
14
|
-
case
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
12
|
+
case options
|
13
|
+
when NilClass then @options
|
14
|
+
when String then @options.merge!(UnityTestRunnerGenerator.grab_config(options))
|
15
|
+
when Hash then @options.merge!(options)
|
16
|
+
else raise 'If you specify arguments, it should be a filename or a hash of options'
|
19
17
|
end
|
20
18
|
require "#{File.expand_path(File.dirname(__FILE__))}/type_sanitizer"
|
21
19
|
end
|
22
20
|
|
23
21
|
def self.default_options
|
24
22
|
{
|
25
|
-
:
|
26
|
-
:
|
27
|
-
:
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:
|
31
|
-
:
|
32
|
-
:
|
33
|
-
:
|
34
|
-
:
|
35
|
-
:
|
23
|
+
includes: [],
|
24
|
+
defines: [],
|
25
|
+
plugins: [],
|
26
|
+
framework: :unity,
|
27
|
+
test_prefix: 'test|spec|should',
|
28
|
+
mock_prefix: 'Mock',
|
29
|
+
setup_name: 'setUp',
|
30
|
+
teardown_name: 'tearDown',
|
31
|
+
main_name: 'main', # set to :auto to automatically generate each time
|
32
|
+
main_export_decl: '',
|
33
|
+
cmdline_args: false,
|
34
|
+
use_param_tests: false
|
36
35
|
}
|
37
36
|
end
|
38
37
|
|
39
38
|
def self.grab_config(config_file)
|
40
|
-
options =
|
41
|
-
unless
|
39
|
+
options = default_options
|
40
|
+
unless config_file.nil? || config_file.empty?
|
42
41
|
require 'yaml'
|
43
42
|
yaml_guts = YAML.load_file(config_file)
|
44
43
|
options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])
|
45
44
|
raise "No :unity or :cmock section found in #{config_file}" unless options
|
46
45
|
end
|
47
|
-
|
46
|
+
options
|
48
47
|
end
|
49
48
|
|
50
|
-
def run(input_file, output_file, options=nil)
|
51
|
-
tests = []
|
52
|
-
testfile_includes = []
|
53
|
-
used_mocks = []
|
54
|
-
|
49
|
+
def run(input_file, output_file, options = nil)
|
55
50
|
@options.merge!(options) unless options.nil?
|
56
|
-
module_name = File.basename(input_file)
|
57
51
|
|
58
|
-
#pull required data from source file
|
52
|
+
# pull required data from source file
|
59
53
|
source = File.read(input_file)
|
60
|
-
source = source.force_encoding(
|
54
|
+
source = source.force_encoding('ISO-8859-1').encode('utf-8', replace: nil)
|
61
55
|
tests = find_tests(source)
|
62
56
|
headers = find_includes(source)
|
63
57
|
testfile_includes = (headers[:local] + headers[:system])
|
64
58
|
used_mocks = find_mocks(testfile_includes)
|
65
59
|
testfile_includes = (testfile_includes - used_mocks)
|
66
|
-
testfile_includes.delete_if{|inc| inc =~ /(unity|cmock)/}
|
60
|
+
testfile_includes.delete_if { |inc| inc =~ /(unity|cmock)/ }
|
67
61
|
|
68
|
-
#build runner file
|
62
|
+
# build runner file
|
69
63
|
generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
70
64
|
|
71
|
-
#determine which files were used to return them
|
65
|
+
# determine which files were used to return them
|
72
66
|
all_files_used = [input_file, output_file]
|
73
|
-
all_files_used += testfile_includes.map {|filename| filename + '.c'} unless testfile_includes.empty?
|
67
|
+
all_files_used += testfile_includes.map { |filename| filename + '.c' } unless testfile_includes.empty?
|
74
68
|
all_files_used += @options[:includes] unless @options[:includes].empty?
|
75
|
-
|
69
|
+
all_files_used += headers[:linkonly] unless headers[:linkonly].empty?
|
70
|
+
all_files_used.uniq
|
76
71
|
end
|
77
72
|
|
78
73
|
def generate(input_file, output_file, tests, used_mocks, testfile_includes)
|
@@ -80,15 +75,16 @@ class UnityTestRunnerGenerator
|
|
80
75
|
create_header(output, used_mocks, testfile_includes)
|
81
76
|
create_externs(output, tests, used_mocks)
|
82
77
|
create_mock_management(output, used_mocks)
|
83
|
-
|
78
|
+
create_suite_setup(output)
|
79
|
+
create_suite_teardown(output)
|
84
80
|
create_reset(output, used_mocks)
|
85
81
|
create_main(output, input_file, tests, used_mocks)
|
86
82
|
end
|
87
83
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
84
|
+
return unless @options[:header_file] && !@options[:header_file].empty?
|
85
|
+
|
86
|
+
File.open(@options[:header_file], 'w') do |output|
|
87
|
+
create_h_file(output, @options[:header_file], tests, testfile_includes, used_mocks)
|
92
88
|
end
|
93
89
|
end
|
94
90
|
|
@@ -96,103 +92,102 @@ class UnityTestRunnerGenerator
|
|
96
92
|
tests_and_line_numbers = []
|
97
93
|
|
98
94
|
source_scrubbed = source.clone
|
99
|
-
source_scrubbed = source_scrubbed.gsub(/"[^"\n]*"/, '')
|
95
|
+
source_scrubbed = source_scrubbed.gsub(/"[^"\n]*"/, '') # remove things in strings
|
100
96
|
source_scrubbed = source_scrubbed.gsub(/\/\/.*$/, '') # remove line comments
|
101
97
|
source_scrubbed = source_scrubbed.gsub(/\/\*.*?\*\//m, '') # remove block comments
|
102
98
|
lines = source_scrubbed.split(/(^\s*\#.*$) # Treat preprocessor directives as a logical line
|
103
99
|
| (;|\{|\}) /x) # Match ;, {, and } as end of lines
|
104
100
|
|
105
|
-
lines.each_with_index do |line,
|
106
|
-
#find tests
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
end
|
117
|
-
tests_and_line_numbers << { :test => name, :args => args, :call => call, :params => params, :line_number => 0 }
|
101
|
+
lines.each_with_index do |line, _index|
|
102
|
+
# find tests
|
103
|
+
next unless line =~ /^((?:\s*TEST_CASE\s*\(.*?\)\s*)*)\s*void\s+((?:#{@options[:test_prefix]}).*)\s*\(\s*(.*)\s*\)/
|
104
|
+
arguments = Regexp.last_match(1)
|
105
|
+
name = Regexp.last_match(2)
|
106
|
+
call = Regexp.last_match(3)
|
107
|
+
params = Regexp.last_match(4)
|
108
|
+
args = nil
|
109
|
+
if @options[:use_param_tests] && !arguments.empty?
|
110
|
+
args = []
|
111
|
+
arguments.scan(/\s*TEST_CASE\s*\((.*)\)\s*$/) { |a| args << a[0] }
|
118
112
|
end
|
113
|
+
tests_and_line_numbers << { test: name, args: args, call: call, params: params, line_number: 0 }
|
119
114
|
end
|
120
|
-
tests_and_line_numbers.uniq! {|v| v[:test] }
|
115
|
+
tests_and_line_numbers.uniq! { |v| v[:test] }
|
121
116
|
|
122
|
-
#determine line numbers and create tests to run
|
117
|
+
# determine line numbers and create tests to run
|
123
118
|
source_lines = source.split("\n")
|
124
|
-
source_index = 0
|
119
|
+
source_index = 0
|
125
120
|
tests_and_line_numbers.size.times do |i|
|
126
121
|
source_lines[source_index..-1].each_with_index do |line, index|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
end
|
122
|
+
next unless line =~ /#{tests_and_line_numbers[i][:test]}/
|
123
|
+
source_index += index
|
124
|
+
tests_and_line_numbers[i][:line_number] = source_index + 1
|
125
|
+
break
|
132
126
|
end
|
133
127
|
end
|
134
128
|
|
135
|
-
|
129
|
+
tests_and_line_numbers
|
136
130
|
end
|
137
131
|
|
138
132
|
def find_includes(source)
|
139
|
-
|
140
|
-
#remove comments (block and line, in three steps to ensure correct precedence)
|
133
|
+
# remove comments (block and line, in three steps to ensure correct precedence)
|
141
134
|
source.gsub!(/\/\/(?:.+\/\*|\*(?:$|[^\/])).*$/, '') # remove line comments that comment out the start of blocks
|
142
135
|
source.gsub!(/\/\*.*?\*\//m, '') # remove block comments
|
143
136
|
source.gsub!(/\/\/.*$/, '') # remove line comments (all that remain)
|
144
137
|
|
145
|
-
#parse out includes
|
138
|
+
# parse out includes
|
146
139
|
includes = {
|
147
|
-
:
|
148
|
-
:
|
140
|
+
local: source.scan(/^\s*#include\s+\"\s*(.+)\.[hH]\s*\"/).flatten,
|
141
|
+
system: source.scan(/^\s*#include\s+<\s*(.+)\s*>/).flatten.map { |inc| "<#{inc}>" },
|
142
|
+
linkonly: source.scan(/^TEST_FILE\(\s*\"\s*(.+)\.[cC]\w*\s*\"/).flatten
|
149
143
|
}
|
150
|
-
|
144
|
+
includes
|
151
145
|
end
|
152
146
|
|
153
147
|
def find_mocks(includes)
|
154
148
|
mock_headers = []
|
155
149
|
includes.each do |include_path|
|
156
150
|
include_file = File.basename(include_path)
|
157
|
-
mock_headers << include_path if
|
151
|
+
mock_headers << include_path if include_file =~ /^#{@options[:mock_prefix]}/i
|
158
152
|
end
|
159
|
-
|
153
|
+
mock_headers
|
160
154
|
end
|
161
155
|
|
162
|
-
def create_header(output, mocks, testfile_includes=[])
|
156
|
+
def create_header(output, mocks, testfile_includes = [])
|
163
157
|
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
164
158
|
create_runtest(output, mocks)
|
165
159
|
output.puts("\n/*=======Automagically Detected Files To Include=====*/")
|
166
|
-
output.puts("#include \"#{@options[:framework]
|
167
|
-
output.puts('#include "cmock.h"') unless
|
160
|
+
output.puts("#include \"#{@options[:framework]}.h\"")
|
161
|
+
output.puts('#include "cmock.h"') unless mocks.empty?
|
168
162
|
output.puts('#include <setjmp.h>')
|
169
163
|
output.puts('#include <stdio.h>')
|
170
|
-
|
171
|
-
|
172
|
-
@options[:defines].each {|d| output.puts("#define #{d}")}
|
164
|
+
if @options[:defines] && !@options[:defines].empty?
|
165
|
+
@options[:defines].each { |d| output.puts("#define #{d}") }
|
173
166
|
end
|
174
|
-
if
|
167
|
+
if @options[:header_file] && !@options[:header_file].empty?
|
175
168
|
output.puts("#include \"#{File.basename(@options[:header_file])}\"")
|
176
169
|
else
|
177
170
|
@options[:includes].flatten.uniq.compact.each do |inc|
|
178
|
-
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
171
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
179
172
|
end
|
180
173
|
testfile_includes.each do |inc|
|
181
|
-
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
174
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
182
175
|
end
|
183
176
|
end
|
184
177
|
mocks.each do |mock|
|
185
|
-
output.puts("#include \"#{mock.gsub('.h','')}.h\"")
|
186
|
-
end
|
187
|
-
if @options[:enforce_strict_ordering]
|
188
|
-
output.puts('')
|
189
|
-
output.puts('int GlobalExpectCount;')
|
190
|
-
output.puts('int GlobalVerifyOrder;')
|
191
|
-
output.puts('char* GlobalOrderError;')
|
178
|
+
output.puts("#include \"#{mock.gsub('.h', '')}.h\"")
|
192
179
|
end
|
180
|
+
output.puts('#include "CException.h"') if @options[:plugins].include?(:cexception)
|
181
|
+
|
182
|
+
return unless @options[:enforce_strict_ordering]
|
183
|
+
|
184
|
+
output.puts('')
|
185
|
+
output.puts('int GlobalExpectCount;')
|
186
|
+
output.puts('int GlobalVerifyOrder;')
|
187
|
+
output.puts('char* GlobalOrderError;')
|
193
188
|
end
|
194
189
|
|
195
|
-
def create_externs(output, tests,
|
190
|
+
def create_externs(output, tests, _mocks)
|
196
191
|
output.puts("\n/*=======External Functions This Runner Calls=====*/")
|
197
192
|
output.puts("extern void #{@options[:setup_name]}(void);")
|
198
193
|
output.puts("extern void #{@options[:teardown_name]}(void);")
|
@@ -203,55 +198,60 @@ class UnityTestRunnerGenerator
|
|
203
198
|
end
|
204
199
|
|
205
200
|
def create_mock_management(output, mock_headers)
|
206
|
-
|
207
|
-
output.puts("\n/*=======Mock Management=====*/")
|
208
|
-
output.puts("static void CMock_Init(void)")
|
209
|
-
output.puts("{")
|
210
|
-
if @options[:enforce_strict_ordering]
|
211
|
-
output.puts(" GlobalExpectCount = 0;")
|
212
|
-
output.puts(" GlobalVerifyOrder = 0;")
|
213
|
-
output.puts(" GlobalOrderError = NULL;")
|
214
|
-
end
|
215
|
-
mocks = mock_headers.map {|mock| File.basename(mock)}
|
216
|
-
mocks.each do |mock|
|
217
|
-
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
218
|
-
output.puts(" #{mock_clean}_Init();")
|
219
|
-
end
|
220
|
-
output.puts("}\n")
|
201
|
+
return if mock_headers.empty?
|
221
202
|
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
226
|
-
output.puts(" #{mock_clean}_Verify();")
|
227
|
-
end
|
228
|
-
output.puts("}\n")
|
203
|
+
output.puts("\n/*=======Mock Management=====*/")
|
204
|
+
output.puts('static void CMock_Init(void)')
|
205
|
+
output.puts('{')
|
229
206
|
|
230
|
-
|
231
|
-
output.puts(
|
232
|
-
|
233
|
-
|
234
|
-
output.puts(" #{mock_clean}_Destroy();")
|
235
|
-
end
|
236
|
-
output.puts("}\n")
|
207
|
+
if @options[:enforce_strict_ordering]
|
208
|
+
output.puts(' GlobalExpectCount = 0;')
|
209
|
+
output.puts(' GlobalVerifyOrder = 0;')
|
210
|
+
output.puts(' GlobalOrderError = NULL;')
|
237
211
|
end
|
238
|
-
end
|
239
212
|
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
output.puts("
|
244
|
-
output.puts("{")
|
245
|
-
output.puts(@options[:suite_setup])
|
246
|
-
output.puts("}")
|
213
|
+
mocks = mock_headers.map { |mock| File.basename(mock) }
|
214
|
+
mocks.each do |mock|
|
215
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
216
|
+
output.puts(" #{mock_clean}_Init();")
|
247
217
|
end
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
218
|
+
output.puts("}\n")
|
219
|
+
|
220
|
+
output.puts('static void CMock_Verify(void)')
|
221
|
+
output.puts('{')
|
222
|
+
mocks.each do |mock|
|
223
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
224
|
+
output.puts(" #{mock_clean}_Verify();")
|
225
|
+
end
|
226
|
+
output.puts("}\n")
|
227
|
+
|
228
|
+
output.puts('static void CMock_Destroy(void)')
|
229
|
+
output.puts('{')
|
230
|
+
mocks.each do |mock|
|
231
|
+
mock_clean = TypeSanitizer.sanitize_c_identifier(mock)
|
232
|
+
output.puts(" #{mock_clean}_Destroy();")
|
254
233
|
end
|
234
|
+
output.puts("}\n")
|
235
|
+
end
|
236
|
+
|
237
|
+
def create_suite_setup(output)
|
238
|
+
return if @options[:suite_setup].nil?
|
239
|
+
|
240
|
+
output.puts("\n/*=======Suite Setup=====*/")
|
241
|
+
output.puts('static void suite_setup(void)')
|
242
|
+
output.puts('{')
|
243
|
+
output.puts(@options[:suite_setup])
|
244
|
+
output.puts('}')
|
245
|
+
end
|
246
|
+
|
247
|
+
def create_suite_teardown(output)
|
248
|
+
return if @options[:suite_teardown].nil?
|
249
|
+
|
250
|
+
output.puts("\n/*=======Suite Teardown=====*/")
|
251
|
+
output.puts('static int suite_teardown(int num_failures)')
|
252
|
+
output.puts('{')
|
253
|
+
output.puts(@options[:suite_teardown])
|
254
|
+
output.puts('}')
|
255
255
|
end
|
256
256
|
|
257
257
|
def create_runtest(output, used_mocks)
|
@@ -259,124 +259,124 @@ class UnityTestRunnerGenerator
|
|
259
259
|
va_args1 = @options[:use_param_tests] ? ', ...' : ''
|
260
260
|
va_args2 = @options[:use_param_tests] ? '__VA_ARGS__' : ''
|
261
261
|
output.puts("\n/*=======Test Runner Used To Run Each Test Below=====*/")
|
262
|
-
output.puts(
|
262
|
+
output.puts('#define RUN_TEST_NO_ARGS') if @options[:use_param_tests]
|
263
263
|
output.puts("#define RUN_TEST(TestFunc, TestLineNum#{va_args1}) \\")
|
264
|
-
output.puts(
|
264
|
+
output.puts('{ \\')
|
265
265
|
output.puts(" Unity.CurrentTestName = #TestFunc#{va_args2.empty? ? '' : " \"(\" ##{va_args2} \")\""}; \\")
|
266
|
-
output.puts(
|
267
|
-
output.puts(
|
268
|
-
output.puts(
|
269
|
-
output.puts(
|
270
|
-
output.puts(
|
271
|
-
output.puts(
|
272
|
-
output.puts(
|
273
|
-
output.puts(
|
274
|
-
output.puts(
|
266
|
+
output.puts(' Unity.CurrentTestLineNumber = TestLineNum; \\')
|
267
|
+
output.puts(' if (UnityTestMatches()) { \\') if @options[:cmdline_args]
|
268
|
+
output.puts(' Unity.NumberOfTests++; \\')
|
269
|
+
output.puts(' CMock_Init(); \\') unless used_mocks.empty?
|
270
|
+
output.puts(' UNITY_CLR_DETAILS(); \\') unless used_mocks.empty?
|
271
|
+
output.puts(' if (TEST_PROTECT()) \\')
|
272
|
+
output.puts(' { \\')
|
273
|
+
output.puts(' CEXCEPTION_T e; \\') if cexception
|
274
|
+
output.puts(' Try { \\') if cexception
|
275
275
|
output.puts(" #{@options[:setup_name]}(); \\")
|
276
276
|
output.puts(" TestFunc(#{va_args2}); \\")
|
277
|
-
output.puts(
|
278
|
-
output.puts(
|
279
|
-
output.puts(
|
280
|
-
output.puts(
|
277
|
+
output.puts(' } Catch(e) { TEST_ASSERT_EQUAL_HEX32_MESSAGE(CEXCEPTION_NONE, e, "Unhandled Exception!"); } \\') if cexception
|
278
|
+
output.puts(' } \\')
|
279
|
+
output.puts(' if (TEST_PROTECT()) \\')
|
280
|
+
output.puts(' { \\')
|
281
281
|
output.puts(" #{@options[:teardown_name]}(); \\")
|
282
|
-
output.puts(
|
283
|
-
output.puts(
|
284
|
-
output.puts(
|
285
|
-
output.puts(
|
286
|
-
output.puts(
|
282
|
+
output.puts(' CMock_Verify(); \\') unless used_mocks.empty?
|
283
|
+
output.puts(' } \\')
|
284
|
+
output.puts(' CMock_Destroy(); \\') unless used_mocks.empty?
|
285
|
+
output.puts(' UnityConcludeTest(); \\')
|
286
|
+
output.puts(' } \\') if @options[:cmdline_args]
|
287
287
|
output.puts("}\n")
|
288
288
|
end
|
289
289
|
|
290
290
|
def create_reset(output, used_mocks)
|
291
291
|
output.puts("\n/*=======Test Reset Option=====*/")
|
292
|
-
output.puts(
|
293
|
-
output.puts(
|
294
|
-
output.puts(
|
295
|
-
output.puts(
|
296
|
-
output.puts(
|
292
|
+
output.puts('void resetTest(void);')
|
293
|
+
output.puts('void resetTest(void)')
|
294
|
+
output.puts('{')
|
295
|
+
output.puts(' CMock_Verify();') unless used_mocks.empty?
|
296
|
+
output.puts(' CMock_Destroy();') unless used_mocks.empty?
|
297
297
|
output.puts(" #{@options[:teardown_name]}();")
|
298
|
-
output.puts(
|
298
|
+
output.puts(' CMock_Init();') unless used_mocks.empty?
|
299
299
|
output.puts(" #{@options[:setup_name]}();")
|
300
|
-
output.puts(
|
300
|
+
output.puts('}')
|
301
301
|
end
|
302
302
|
|
303
303
|
def create_main(output, filename, tests, used_mocks)
|
304
304
|
output.puts("\n\n/*=======MAIN=====*/")
|
305
|
-
main_name =
|
306
|
-
if
|
307
|
-
if
|
305
|
+
main_name = @options[:main_name].to_sym == :auto ? "main_#{filename.gsub('.c', '')}" : (@options[:main_name]).to_s
|
306
|
+
if @options[:cmdline_args]
|
307
|
+
if main_name != 'main'
|
308
308
|
output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv);")
|
309
309
|
end
|
310
310
|
output.puts("#{@options[:main_export_decl]} int #{main_name}(int argc, char** argv)")
|
311
|
-
output.puts(
|
312
|
-
output.puts(
|
313
|
-
output.puts(
|
314
|
-
output.puts(
|
315
|
-
output.puts(
|
316
|
-
output.puts(
|
317
|
-
output.puts(" UnityPrint(\"#{filename.gsub('.c','')}.\");")
|
318
|
-
output.puts(
|
319
|
-
if
|
311
|
+
output.puts('{')
|
312
|
+
output.puts(' int parse_status = UnityParseOptions(argc, argv);')
|
313
|
+
output.puts(' if (parse_status != 0)')
|
314
|
+
output.puts(' {')
|
315
|
+
output.puts(' if (parse_status < 0)')
|
316
|
+
output.puts(' {')
|
317
|
+
output.puts(" UnityPrint(\"#{filename.gsub('.c', '')}.\");")
|
318
|
+
output.puts(' UNITY_PRINT_EOL();')
|
319
|
+
if @options[:use_param_tests]
|
320
320
|
tests.each do |test|
|
321
|
-
if
|
321
|
+
if test[:args].nil? || test[:args].empty?
|
322
322
|
output.puts(" UnityPrint(\" #{test[:test]}(RUN_TEST_NO_ARGS)\");")
|
323
|
-
output.puts(
|
323
|
+
output.puts(' UNITY_PRINT_EOL();')
|
324
324
|
else
|
325
325
|
test[:args].each do |args|
|
326
326
|
output.puts(" UnityPrint(\" #{test[:test]}(#{args})\");")
|
327
|
-
output.puts(
|
327
|
+
output.puts(' UNITY_PRINT_EOL();')
|
328
328
|
end
|
329
329
|
end
|
330
330
|
end
|
331
331
|
else
|
332
|
-
tests.each { |test| output.puts(" UnityPrint(\" #{test[:test]}\");\n UNITY_PRINT_EOL();")}
|
332
|
+
tests.each { |test| output.puts(" UnityPrint(\" #{test[:test]}\");\n UNITY_PRINT_EOL();") }
|
333
333
|
end
|
334
|
-
output.puts(
|
335
|
-
output.puts(
|
336
|
-
output.puts(
|
337
|
-
output.puts(
|
334
|
+
output.puts(' return 0;')
|
335
|
+
output.puts(' }')
|
336
|
+
output.puts(' return parse_status;')
|
337
|
+
output.puts(' }')
|
338
338
|
else
|
339
|
-
if
|
339
|
+
if main_name != 'main'
|
340
340
|
output.puts("#{@options[:main_export_decl]} int #{main_name}(void);")
|
341
341
|
end
|
342
342
|
output.puts("int #{main_name}(void)")
|
343
|
-
output.puts(
|
343
|
+
output.puts('{')
|
344
344
|
end
|
345
|
-
output.puts(
|
346
|
-
output.puts(" UnityBegin(\"#{filename.gsub(/\\/,'\\\\\\')}\");")
|
347
|
-
if
|
345
|
+
output.puts(' suite_setup();') unless @options[:suite_setup].nil?
|
346
|
+
output.puts(" UnityBegin(\"#{filename.gsub(/\\/, '\\\\\\')}\");")
|
347
|
+
if @options[:use_param_tests]
|
348
348
|
tests.each do |test|
|
349
|
-
if
|
349
|
+
if test[:args].nil? || test[:args].empty?
|
350
350
|
output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, RUN_TEST_NO_ARGS);")
|
351
351
|
else
|
352
|
-
test[:args].each {|args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});")}
|
352
|
+
test[:args].each { |args| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]}, #{args});") }
|
353
353
|
end
|
354
354
|
end
|
355
355
|
else
|
356
|
-
|
356
|
+
tests.each { |test| output.puts(" RUN_TEST(#{test[:test]}, #{test[:line_number]});") }
|
357
357
|
end
|
358
|
-
output.puts
|
359
|
-
output.puts(
|
360
|
-
output.puts(" return #{@options[:suite_teardown].nil? ?
|
361
|
-
output.puts(
|
358
|
+
output.puts
|
359
|
+
output.puts(' CMock_Guts_MemFreeFinal();') unless used_mocks.empty?
|
360
|
+
output.puts(" return #{@options[:suite_teardown].nil? ? '' : 'suite_teardown'}(UnityEnd());")
|
361
|
+
output.puts('}')
|
362
362
|
end
|
363
363
|
|
364
364
|
def create_h_file(output, filename, tests, testfile_includes, used_mocks)
|
365
|
-
filename = File.basename(filename).gsub(/[-\/\\\.\,\s]/,
|
366
|
-
output.puts(
|
365
|
+
filename = File.basename(filename).gsub(/[-\/\\\.\,\s]/, '_').upcase
|
366
|
+
output.puts('/* AUTOGENERATED FILE. DO NOT EDIT. */')
|
367
367
|
output.puts("#ifndef _#{filename}")
|
368
368
|
output.puts("#define _#{filename}\n\n")
|
369
|
-
output.puts("#include \"#{@options[:framework]
|
370
|
-
output.puts('#include "cmock.h"') unless
|
369
|
+
output.puts("#include \"#{@options[:framework]}.h\"")
|
370
|
+
output.puts('#include "cmock.h"') unless used_mocks.empty?
|
371
371
|
@options[:includes].flatten.uniq.compact.each do |inc|
|
372
|
-
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
372
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
373
373
|
end
|
374
374
|
testfile_includes.each do |inc|
|
375
|
-
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h','')}.h\""}")
|
375
|
+
output.puts("#include #{inc.include?('<') ? inc : "\"#{inc.gsub('.h', '')}.h\""}")
|
376
376
|
end
|
377
377
|
output.puts "\n"
|
378
378
|
tests.each do |test|
|
379
|
-
if
|
379
|
+
if test[:params].nil? || test[:params].empty?
|
380
380
|
output.puts("void #{test[:test]}(void);")
|
381
381
|
else
|
382
382
|
output.puts("void #{test[:test]}(#{test[:params]});")
|
@@ -386,50 +386,52 @@ class UnityTestRunnerGenerator
|
|
386
386
|
end
|
387
387
|
end
|
388
388
|
|
389
|
-
if
|
390
|
-
options = { :
|
391
|
-
yaml_file = nil
|
389
|
+
if $0 == __FILE__
|
390
|
+
options = { includes: [] }
|
392
391
|
|
393
|
-
#parse out all the options first (these will all be removed as we go)
|
392
|
+
# parse out all the options first (these will all be removed as we go)
|
394
393
|
ARGV.reject! do |arg|
|
395
|
-
case
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
|
401
|
-
|
402
|
-
|
403
|
-
|
404
|
-
|
394
|
+
case arg
|
395
|
+
when '-cexception'
|
396
|
+
options[:plugins] = [:cexception]
|
397
|
+
true
|
398
|
+
when /\.*\.ya?ml/
|
399
|
+
options = UnityTestRunnerGenerator.grab_config(arg)
|
400
|
+
true
|
401
|
+
when /--(\w+)=\"?(.*)\"?/
|
402
|
+
options[Regexp.last_match(1).to_sym] = Regexp.last_match(2)
|
403
|
+
true
|
404
|
+
when /\.*\.h/
|
405
|
+
options[:includes] << arg
|
406
|
+
true
|
407
|
+
else false
|
405
408
|
end
|
406
409
|
end
|
407
410
|
|
408
|
-
#make sure there is at least one parameter left (the input file)
|
409
|
-
|
411
|
+
# make sure there is at least one parameter left (the input file)
|
412
|
+
unless ARGV[0]
|
410
413
|
puts ["\nusage: ruby #{__FILE__} (files) (options) input_test_file (output)",
|
411
|
-
|
412
|
-
|
413
|
-
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
].join("\n")
|
414
|
+
"\n input_test_file - this is the C file you want to create a runner for",
|
415
|
+
' output - this is the name of the runner file to generate',
|
416
|
+
' defaults to (input_test_file)_Runner',
|
417
|
+
' files:',
|
418
|
+
' *.yml / *.yaml - loads configuration from here in :unity or :cmock',
|
419
|
+
' *.h - header files are added as #includes in runner',
|
420
|
+
' options:',
|
421
|
+
' -cexception - include cexception support',
|
422
|
+
' --setup_name="" - redefine setUp func name to something else',
|
423
|
+
' --teardown_name="" - redefine tearDown func name to something else',
|
424
|
+
' --main_name="" - redefine main func name to something else',
|
425
|
+
' --test_prefix="" - redefine test prefix from default test|spec|should',
|
426
|
+
' --suite_setup="" - code to execute for setup of entire suite',
|
427
|
+
' --suite_teardown="" - code to execute for teardown of entire suite',
|
428
|
+
' --use_param_tests=1 - enable parameterized tests (disabled by default)',
|
429
|
+
' --header_file="" - path/name of test header file to generate too'].join("\n")
|
428
430
|
exit 1
|
429
431
|
end
|
430
432
|
|
431
|
-
#create the default test runner name if not specified
|
432
|
-
ARGV[1] = ARGV[0].gsub(
|
433
|
+
# create the default test runner name if not specified
|
434
|
+
ARGV[1] = ARGV[0].gsub('.c', '_Runner.c') unless ARGV[1]
|
433
435
|
|
434
436
|
UnityTestRunnerGenerator.new(options).run(ARGV[0], ARGV[1])
|
435
437
|
end
|