ceedling 0.13.0 → 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/Gemfile +1 -1
- data/Gemfile.lock +18 -14
- data/README.md +6 -4
- data/assets/project_as_gem.yml +1 -1
- data/assets/rakefile_as_gem.rb +2 -0
- data/assets/rakefile_with_guts.rb +3 -1
- data/ceedling.gemspec +1 -0
- data/examples/blinky/rakefile.rb +2 -2
- data/examples/temp_sensor/rakefile.rb +1 -1
- data/examples/temp_sensor/src/TemperatureFilter.c +1 -2
- data/examples/temp_sensor/test/TestTemperatureCalculator.c +1 -1
- data/examples/temp_sensor/test/TestTemperatureFilter.c +12 -2
- data/lib/ceedling.rb +94 -22
- data/lib/{build_invoker_utils.rb → ceedling/build_invoker_utils.rb} +27 -27
- data/lib/{cacheinator.rb → ceedling/cacheinator.rb} +42 -42
- data/lib/{cacheinator_helper.rb → ceedling/cacheinator_helper.rb} +12 -12
- data/lib/{cmock_builder.rb → ceedling/cmock_builder.rb} +15 -15
- data/lib/{configurator.rb → ceedling/configurator.rb} +333 -329
- data/lib/{configurator_builder.rb → ceedling/configurator_builder.rb} +437 -437
- data/lib/{configurator_plugins.rb → ceedling/configurator_plugins.rb} +124 -124
- data/lib/{configurator_setup.rb → ceedling/configurator_setup.rb} +124 -124
- data/lib/{configurator_validator.rb → ceedling/configurator_validator.rb} +184 -184
- data/lib/{constants.rb → ceedling/constants.rb} +20 -17
- data/lib/{defaults.rb → ceedling/defaults.rb} +19 -18
- data/lib/{dependinator.rb → ceedling/dependinator.rb} +92 -92
- data/lib/{erb_wrapper.rb → ceedling/erb_wrapper.rb} +8 -8
- data/lib/{file_finder.rb → ceedling/file_finder.rb} +132 -132
- data/lib/{file_finder_helper.rb → ceedling/file_finder_helper.rb} +54 -54
- data/lib/{file_path_utils.rb → ceedling/file_path_utils.rb} +189 -189
- data/lib/{file_system_utils.rb → ceedling/file_system_utils.rb} +69 -69
- data/lib/{file_system_wrapper.rb → ceedling/file_system_wrapper.rb} +9 -9
- data/lib/{file_wrapper.rb → ceedling/file_wrapper.rb} +79 -79
- data/lib/{flaginator.rb → ceedling/flaginator.rb} +54 -54
- data/lib/{generator.rb → ceedling/generator.rb} +164 -164
- data/lib/{generator_helper.rb → ceedling/generator_helper.rb} +40 -40
- data/lib/{generator_test_results.rb → ceedling/generator_test_results.rb} +86 -89
- data/lib/{generator_test_results_sanity_checker.rb → ceedling/generator_test_results_sanity_checker.rb} +64 -62
- data/lib/{generator_test_runner.rb → ceedling/generator_test_runner.rb} +63 -63
- data/lib/{loginator.rb → ceedling/loginator.rb} +31 -31
- data/lib/{makefile.rb → ceedling/makefile.rb} +0 -0
- data/lib/{objects.yml → ceedling/objects.yml} +0 -0
- data/lib/{par_map.rb → ceedling/par_map.rb} +0 -0
- data/lib/{plugin.rb → ceedling/plugin.rb} +80 -80
- data/lib/{plugin_builder.rb → ceedling/plugin_builder.rb} +52 -52
- data/lib/{plugin_manager.rb → ceedling/plugin_manager.rb} +107 -107
- data/lib/{plugin_manager_helper.rb → ceedling/plugin_manager_helper.rb} +19 -19
- data/lib/{plugin_reportinator.rb → ceedling/plugin_reportinator.rb} +2 -2
- data/lib/{plugin_reportinator_helper.rb → ceedling/plugin_reportinator_helper.rb} +1 -1
- data/lib/{preprocessinator.rb → ceedling/preprocessinator.rb} +43 -43
- data/lib/{preprocessinator_extractor.rb → ceedling/preprocessinator_extractor.rb} +30 -30
- data/lib/{preprocessinator_file_handler.rb → ceedling/preprocessinator_file_handler.rb} +21 -21
- data/lib/{preprocessinator_helper.rb → ceedling/preprocessinator_helper.rb} +46 -46
- data/lib/ceedling/preprocessinator_includes_handler.rb +82 -0
- data/lib/{project_config_manager.rb → ceedling/project_config_manager.rb} +38 -38
- data/lib/{project_file_loader.rb → ceedling/project_file_loader.rb} +64 -64
- data/lib/{rake_utils.rb → ceedling/rake_utils.rb} +17 -17
- data/lib/{rake_wrapper.rb → ceedling/rake_wrapper.rb} +33 -33
- data/lib/{rakefile.rb → ceedling/rakefile.rb} +78 -74
- data/lib/{release_invoker.rb → ceedling/release_invoker.rb} +58 -58
- data/lib/{release_invoker_helper.rb → ceedling/release_invoker_helper.rb} +16 -16
- data/lib/{reportinator.rb → ceedling/reportinator.rb} +9 -9
- data/lib/{rules_cmock.rake → ceedling/rules_cmock.rake} +9 -9
- data/lib/{rules_preprocess.rake → ceedling/rules_preprocess.rake} +26 -26
- data/lib/{rules_release.rake → ceedling/rules_release.rake} +79 -79
- data/lib/{rules_release_deep_dependencies.rake → ceedling/rules_release_deep_dependencies.rake} +15 -15
- data/lib/{rules_tests.rake → ceedling/rules_tests.rake} +59 -59
- data/lib/{rules_tests_deep_dependencies.rake → ceedling/rules_tests_deep_dependencies.rake} +15 -15
- data/lib/{setupinator.rb → ceedling/setupinator.rb} +51 -51
- data/lib/{stream_wrapper.rb → ceedling/stream_wrapper.rb} +20 -20
- data/lib/{streaminator.rb → ceedling/streaminator.rb} +40 -41
- data/lib/{streaminator_helper.rb → ceedling/streaminator_helper.rb} +15 -15
- data/lib/{system_utils.rb → ceedling/system_utils.rb} +0 -0
- data/lib/{system_wrapper.rb → ceedling/system_wrapper.rb} +76 -76
- data/lib/{target_loader.rb → ceedling/target_loader.rb} +0 -0
- data/lib/{task_invoker.rb → ceedling/task_invoker.rb} +89 -89
- data/lib/{tasks_base.rake → ceedling/tasks_base.rake} +104 -104
- data/lib/{tasks_filesystem.rake → ceedling/tasks_filesystem.rake} +91 -91
- data/lib/{tasks_release.rake → ceedling/tasks_release.rake} +28 -28
- data/lib/{tasks_release_deep_dependencies.rake → ceedling/tasks_release_deep_dependencies.rake} +9 -9
- data/lib/{tasks_tests.rake → ceedling/tasks_tests.rake} +52 -52
- data/lib/{tasks_tests_deep_dependencies.rake → ceedling/tasks_tests_deep_dependencies.rake} +9 -9
- data/lib/{tasks_vendor.rake → ceedling/tasks_vendor.rake} +36 -36
- data/lib/{test_includes_extractor.rb → ceedling/test_includes_extractor.rb} +81 -81
- data/lib/{test_invoker.rb → ceedling/test_invoker.rb} +97 -97
- data/lib/{test_invoker_helper.rb → ceedling/test_invoker_helper.rb} +28 -28
- data/lib/{tool_executor.rb → ceedling/tool_executor.rb} +215 -212
- data/lib/{tool_executor_helper.rb → ceedling/tool_executor_helper.rb} +115 -115
- data/lib/{verbosinator.rb → ceedling/verbosinator.rb} +10 -10
- data/lib/ceedling/version.rb +1 -1
- data/lib/{yaml_wrapper.rb → ceedling/yaml_wrapper.rb} +17 -16
- data/license.txt +31 -0
- data/plugins/bullseye/lib/bullseye.rb +2 -2
- data/plugins/gcov/gcov.rb +2 -2
- data/plugins/module_generator/lib/module_generator.rb +4 -3
- data/plugins/stdout_ide_tests_report/lib/stdout_ide_tests_report.rb +8 -8
- data/plugins/stdout_pretty_tests_report/lib/stdout_pretty_tests_report.rb +3 -3
- data/plugins/teamcity_tests_report/config/teamcity_tests_report.yml +4 -0
- data/plugins/teamcity_tests_report/lib/teamcity_tests_report.rb +57 -0
- data/plugins/xml_tests_report/xml_tests_report.rb +4 -4
- data/release/version.info +1 -1
- data/spec/ceedling_spec.rb +154 -0
- data/spec/par_map_spec.rb +1 -1
- data/spec/preprocessinator_extractor_spec.rb +26 -27
- data/spec/preprocessinator_includes_handler_spec.rb +175 -0
- data/spec/spec_helper.rb +8 -27
- data/test_graveyard/integration/paths_test.rb +2 -2
- data/test_graveyard/unit/busted/configurator_builder_test.rb +2 -2
- data/test_graveyard/unit/busted/configurator_test.rb +1 -1
- data/test_graveyard/unit/busted/configurator_validator_test.rb +1 -1
- data/test_graveyard/unit/busted/dependinator_test.rb +1 -1
- data/test_graveyard/unit/busted/file_finder_helper_test.rb +1 -1
- data/test_graveyard/unit/busted/file_finder_test.rb +1 -1
- data/test_graveyard/unit/busted/file_path_utils_test.rb +1 -1
- data/test_graveyard/unit/busted/file_system_utils_test.rb +1 -1
- data/test_graveyard/unit/busted/generator_test.rb +1 -1
- data/test_graveyard/unit/busted/generator_test_results_test.rb +1 -1
- data/test_graveyard/unit/busted/generator_test_runner_test.rb +1 -1
- data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +1 -1
- data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +1 -1
- data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +1 -1
- data/test_graveyard/unit/busted/preprocessinator_test.rb +1 -1
- data/test_graveyard/unit/busted/project_file_loader_test.rb +1 -1
- data/test_graveyard/unit/busted/setupinator_test.rb +1 -1
- data/test_graveyard/unit/busted/streaminator_test.rb +2 -2
- data/test_graveyard/unit/busted/task_invoker_test.rb +1 -1
- data/test_graveyard/unit/busted/test_includes_extractor_test.rb +1 -1
- data/test_graveyard/unit/busted/test_invoker_helper_test.rb +1 -1
- data/test_graveyard/unit/busted/test_invoker_test.rb +1 -1
- data/test_graveyard/unit/busted/tool_executor_helper_test.rb +1 -1
- data/test_graveyard/unit/busted/tool_executor_test.rb +1 -1
- data/test_graveyard/unit/busted/verbosinator_test.rb +1 -1
- data/test_graveyard/unit/preprocessinator_extractor_test.rb +1 -1
- data/vendor/c_exception/Gemfile +4 -0
- data/vendor/c_exception/lib/CException.h +1 -1
- data/vendor/c_exception/test/TestException.c +25 -14
- data/vendor/c_exception/test/TestException_Runner.c +74 -57
- data/vendor/cmock/Gemfile +11 -0
- data/vendor/cmock/lib/cmock_generator.rb +13 -12
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +44 -0
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +74 -0
- data/vendor/cmock/lib/cmock_generator_utils.rb +67 -42
- data/vendor/cmock/src/cmock.c +20 -30
- data/vendor/cmock/src/cmock.h +1 -0
- data/vendor/cmock/src/cmock_internals.h +43 -0
- data/vendor/cmock/test/c/TestCMockC.c +79 -36
- data/vendor/cmock/test/c/TestCMockC_Runner.c +2 -0
- data/vendor/cmock/test/spec/cmock_file_writer_spec.rb +21 -1
- data/vendor/cmock/test/spec/cmock_generator_plugin_array_spec.rb +52 -0
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +2 -0
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +235 -0
- data/vendor/cmock/test/test_helper.rb +10 -5
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +38 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +116 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +134 -0
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +58 -33
- 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/docs/license.txt +30 -0
- data/vendor/cmock/vendor/c_exception/docs/readme.txt +236 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.c +39 -0
- data/vendor/cmock/vendor/c_exception/lib/CException.h +70 -0
- data/vendor/cmock/vendor/c_exception/makefile +24 -0
- data/vendor/cmock/vendor/c_exception/rakefile.rb +41 -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 +27 -0
- data/vendor/cmock/vendor/c_exception/test/TestException.c +291 -0
- data/vendor/cmock/vendor/c_exception/test/TestException_Runner.c +62 -0
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +94 -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 +202 -0
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +313 -0
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +23 -0
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +139 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.odt +0 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.pdf +0 -0
- data/vendor/cmock/vendor/unity/docs/Unity Summary.txt +217 -0
- data/vendor/cmock/vendor/unity/docs/license.txt +31 -0
- data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.c +10 -0
- data/vendor/cmock/vendor/unity/examples/helper/UnityHelper.h +12 -0
- data/vendor/cmock/vendor/unity/examples/makefile +40 -0
- data/vendor/cmock/vendor/unity/examples/rakefile.rb +32 -0
- data/vendor/cmock/vendor/unity/examples/rakefile_helper.rb +256 -0
- data/vendor/cmock/vendor/unity/examples/readme.txt +18 -0
- data/vendor/cmock/vendor/unity/examples/src/ProductionCode.c +24 -0
- data/vendor/cmock/vendor/unity/examples/src/ProductionCode.h +3 -0
- data/vendor/cmock/vendor/unity/examples/src/ProductionCode2.c +9 -0
- data/vendor/cmock/vendor/unity/examples/src/ProductionCode2.h +2 -0
- data/vendor/cmock/vendor/unity/examples/test/TestProductionCode.c +62 -0
- data/vendor/cmock/vendor/unity/examples/test/TestProductionCode2.c +31 -0
- data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode2_Runner.c +46 -0
- data/vendor/cmock/vendor/unity/examples/test/no_ruby/TestProductionCode_Runner.c +50 -0
- data/vendor/{unity → cmock/vendor/unity}/extras/fixture/build/MakefileWorker.mk +0 -0
- data/vendor/{unity → cmock/vendor/unity}/extras/fixture/build/filterGcov.sh +0 -0
- data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +37 -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 +381 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +81 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +44 -0
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +16 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +21 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/testunity_fixture.c +39 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +321 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +40 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.c +56 -0
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_output_Spy.h +17 -0
- data/vendor/cmock/vendor/unity/makefile +35 -0
- data/vendor/cmock/vendor/unity/rakefile.rb +48 -0
- data/vendor/cmock/vendor/unity/rakefile_helper.rb +240 -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 +979 -0
- data/vendor/cmock/vendor/unity/src/unity.h +232 -0
- data/vendor/cmock/vendor/unity/src/unity_internals.h +424 -0
- data/vendor/cmock/vendor/unity/targets/gcc.yml +43 -0
- data/vendor/cmock/vendor/unity/targets/gcc_64.yml +44 -0
- data/vendor/cmock/vendor/unity/targets/hitech_picc18.yml +101 -0
- data/vendor/cmock/vendor/unity/targets/iar_arm_v4.yml +89 -0
- data/vendor/cmock/vendor/unity/targets/iar_arm_v5.yml +79 -0
- data/vendor/cmock/vendor/unity/targets/iar_arm_v5_3.yml +79 -0
- data/vendor/cmock/vendor/unity/targets/iar_armcortex_LM3S9B92_v5_4.yml +93 -0
- data/vendor/cmock/vendor/unity/targets/iar_cortexm3_v5.yml +83 -0
- data/vendor/cmock/vendor/unity/targets/iar_msp430.yml +94 -0
- data/vendor/cmock/vendor/unity/targets/iar_sh2a_v6.yml +85 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_cmd.c +54 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_def.c +50 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_cmd.c +76 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_def.c +72 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new1.c +85 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_new2.c +85 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_param.c +73 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run1.c +85 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_run2.c +85 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_mock_yaml.c +86 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new1.c +60 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_new2.c +63 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_param.c +51 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run1.c +60 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_run2.c +63 -0
- data/vendor/cmock/vendor/unity/test/expectdata/testsample_yaml.c +64 -0
- data/vendor/cmock/vendor/unity/test/test_generate_test_runner.rb +94 -0
- data/vendor/cmock/vendor/unity/test/testdata/mocksample.c +51 -0
- data/vendor/cmock/vendor/unity/test/testdata/sample.yml +9 -0
- data/vendor/cmock/vendor/unity/test/testdata/testsample.c +51 -0
- data/vendor/cmock/vendor/unity/test/testparameterized.c +101 -0
- data/vendor/cmock/vendor/unity/test/testunity.c +2024 -0
- data/vendor/unity/Gemfile +4 -0
- data/vendor/unity/auto/generate_test_runner.rb +6 -3
- data/vendor/unity/examples/makefile +2 -2
- data/vendor/unity/examples/rakefile.rb +13 -2
- data/vendor/unity/extras/fixture/rakefile.rb +1 -1
- data/vendor/unity/extras/fixture/rakefile_helper.rb +4 -3
- data/vendor/unity/extras/fixture/src/unity_fixture.c +15 -12
- data/vendor/unity/extras/fixture/src/unity_fixture.h +5 -5
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +1 -1
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +6 -3
- data/vendor/unity/makefile +2 -2
- data/vendor/unity/src/unity.c +183 -16
- data/vendor/unity/src/unity.h +18 -5
- data/vendor/unity/src/unity_internals.h +57 -23
- data/vendor/unity/targets/gcc_64.yml +45 -0
- data/vendor/unity/test/testunity.c +436 -28
- metadata +200 -137
- data/ceedling-0.13.0.rc4.gem +0 -0
- data/ceedling.sublime-project +0 -8
- data/ceedling.sublime-workspace +0 -365
- data/lib/preprocessinator_includes_handler.rb +0 -55
- data/tags +0 -977
- data/vendor/cmock/vendor/hardmock/CHANGES +0 -78
- data/vendor/cmock/vendor/hardmock/LICENSE +0 -7
- data/vendor/cmock/vendor/hardmock/README +0 -70
- data/vendor/cmock/vendor/hardmock/Rakefile +0 -8
- data/vendor/cmock/vendor/hardmock/config/environment.rb +0 -12
- data/vendor/cmock/vendor/hardmock/lib/assert_error.rb +0 -23
- data/vendor/cmock/vendor/hardmock/lib/extend_test_unit.rb +0 -14
- data/vendor/cmock/vendor/hardmock/lib/hardmock.rb +0 -86
- data/vendor/cmock/vendor/hardmock/lib/hardmock/errors.rb +0 -22
- data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation.rb +0 -229
- data/vendor/cmock/vendor/hardmock/lib/hardmock/expectation_builder.rb +0 -9
- data/vendor/cmock/vendor/hardmock/lib/hardmock/expector.rb +0 -26
- data/vendor/cmock/vendor/hardmock/lib/hardmock/method_cleanout.rb +0 -33
- data/vendor/cmock/vendor/hardmock/lib/hardmock/mock.rb +0 -180
- data/vendor/cmock/vendor/hardmock/lib/hardmock/mock_control.rb +0 -53
- data/vendor/cmock/vendor/hardmock/lib/hardmock/stubbing.rb +0 -210
- data/vendor/cmock/vendor/hardmock/lib/hardmock/trapper.rb +0 -31
- data/vendor/cmock/vendor/hardmock/lib/hardmock/utils.rb +0 -9
- data/vendor/cmock/vendor/hardmock/lib/test_unit_before_after.rb +0 -169
- data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc.rake +0 -19
- data/vendor/cmock/vendor/hardmock/rake_tasks/rdoc_options.rb +0 -4
- data/vendor/cmock/vendor/hardmock/rake_tasks/test.rake +0 -22
- data/vendor/cmock/vendor/hardmock/test/functional/assert_error_test.rb +0 -52
- data/vendor/cmock/vendor/hardmock/test/functional/auto_verify_test.rb +0 -178
- data/vendor/cmock/vendor/hardmock/test/functional/direct_mock_usage_test.rb +0 -396
- data/vendor/cmock/vendor/hardmock/test/functional/hardmock_test.rb +0 -434
- data/vendor/cmock/vendor/hardmock/test/functional/stubbing_test.rb +0 -479
- data/vendor/cmock/vendor/hardmock/test/test_helper.rb +0 -43
- data/vendor/cmock/vendor/hardmock/test/unit/expectation_builder_test.rb +0 -19
- data/vendor/cmock/vendor/hardmock/test/unit/expectation_test.rb +0 -372
- data/vendor/cmock/vendor/hardmock/test/unit/expector_test.rb +0 -57
- data/vendor/cmock/vendor/hardmock/test/unit/method_cleanout_test.rb +0 -36
- data/vendor/cmock/vendor/hardmock/test/unit/mock_control_test.rb +0 -175
- data/vendor/cmock/vendor/hardmock/test/unit/mock_test.rb +0 -279
- data/vendor/cmock/vendor/hardmock/test/unit/test_unit_before_after_test.rb +0 -452
- data/vendor/cmock/vendor/hardmock/test/unit/trapper_test.rb +0 -62
- data/vendor/cmock/vendor/hardmock/test/unit/verify_error_test.rb +0 -40
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
|
|
2
|
-
|
|
3
|
-
class TestUnitBeforeAfter < Test::Unit::TestCase
|
|
4
|
-
|
|
5
|
-
#
|
|
6
|
-
# after_teardown
|
|
7
|
-
#
|
|
8
|
-
|
|
9
|
-
it "adds TestCase.after_teardown hook for appending post-teardown actions" do
|
|
10
|
-
write_and_run_test :use_after_teardown => true
|
|
11
|
-
|
|
12
|
-
see_in_order "Loaded suite",
|
|
13
|
-
"THE SETUP",
|
|
14
|
-
"A TEST",
|
|
15
|
-
"THE TEARDOWN",
|
|
16
|
-
"1st after_teardown",
|
|
17
|
-
"2nd after_teardown",
|
|
18
|
-
"Finished in"
|
|
19
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0
|
|
20
|
-
end
|
|
21
|
-
|
|
22
|
-
should "execute all after_teardowns, even if the main teardown flunks" do
|
|
23
|
-
write_and_run_test :use_after_teardown => true, :flunk_in_teardown => true
|
|
24
|
-
see_in_order "Loaded suite",
|
|
25
|
-
"THE SETUP",
|
|
26
|
-
"A TEST",
|
|
27
|
-
"F",
|
|
28
|
-
"1st after_teardown",
|
|
29
|
-
"2nd after_teardown",
|
|
30
|
-
"Finished in",
|
|
31
|
-
"1) Failure:",
|
|
32
|
-
"test_something(MyExampleTest) [_test_file_temp.rb:20]:",
|
|
33
|
-
"FLUNK IN TEARDOWN"
|
|
34
|
-
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
|
|
35
|
-
end
|
|
36
|
-
|
|
37
|
-
should "execute all after_teardowns, even if the main teardown explodes" do
|
|
38
|
-
write_and_run_test :use_after_teardown => true, :raise_in_teardown => true
|
|
39
|
-
see_in_order "Loaded suite",
|
|
40
|
-
"THE SETUP",
|
|
41
|
-
"A TEST",
|
|
42
|
-
"E",
|
|
43
|
-
"1st after_teardown",
|
|
44
|
-
"2nd after_teardown",
|
|
45
|
-
"Finished in",
|
|
46
|
-
"RuntimeError: ERROR IN TEARDOWN"
|
|
47
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1
|
|
48
|
-
end
|
|
49
|
-
|
|
50
|
-
should "execute all after_teardowns, even if some of them flunk" do
|
|
51
|
-
write_and_run_test :use_after_teardown => true, :flunk_in_after_teardown => true
|
|
52
|
-
see_in_order "Loaded suite",
|
|
53
|
-
"THE SETUP",
|
|
54
|
-
"A TEST",
|
|
55
|
-
"THE TEARDOWN",
|
|
56
|
-
"1st after_teardown",
|
|
57
|
-
"F",
|
|
58
|
-
"2nd after_teardown",
|
|
59
|
-
"Finished in",
|
|
60
|
-
"1) Failure:",
|
|
61
|
-
"test_something(MyExampleTest) [_test_file_temp.rb:7]:",
|
|
62
|
-
"Flunk in first after_teardown",
|
|
63
|
-
"2) Failure:",
|
|
64
|
-
"test_something(MyExampleTest) [_test_file_temp.rb:10]:",
|
|
65
|
-
"Flunk in second after_teardown"
|
|
66
|
-
see_results :tests => 1, :assertions => 2, :failures => 2, :errors => 0
|
|
67
|
-
end
|
|
68
|
-
|
|
69
|
-
should "execute all after_teardowns, even if some of them explode" do
|
|
70
|
-
write_and_run_test :use_after_teardown => true, :raise_in_after_teardown => true
|
|
71
|
-
see_in_order "Loaded suite",
|
|
72
|
-
"THE SETUP",
|
|
73
|
-
"A TEST",
|
|
74
|
-
"THE TEARDOWN",
|
|
75
|
-
"1st after_teardown",
|
|
76
|
-
"E",
|
|
77
|
-
"2nd after_teardown",
|
|
78
|
-
"Finished in",
|
|
79
|
-
"RuntimeError: Error in first after_teardown",
|
|
80
|
-
"RuntimeError: Error in second after_teardown"
|
|
81
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 2
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
it "will run after_teardowns in the absence of a regular teardown" do
|
|
85
|
-
write_and_run_test :omit_teardown => true, :use_after_teardown => true
|
|
86
|
-
see_in_order "Loaded suite",
|
|
87
|
-
"THE SETUP",
|
|
88
|
-
"A TEST",
|
|
89
|
-
"1st after_teardown",
|
|
90
|
-
"2nd after_teardown",
|
|
91
|
-
"Finished in"
|
|
92
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0
|
|
93
|
-
end
|
|
94
|
-
|
|
95
|
-
should "not interfere with normal test writing" do
|
|
96
|
-
write_and_run_test
|
|
97
|
-
see_in_order "Loaded suite",
|
|
98
|
-
"THE SETUP",
|
|
99
|
-
"A TEST",
|
|
100
|
-
"THE TEARDOWN",
|
|
101
|
-
"Finished in"
|
|
102
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0
|
|
103
|
-
end
|
|
104
|
-
|
|
105
|
-
it "provides a cleaned-up backtrace" do
|
|
106
|
-
write_and_run_test :with_failure => true
|
|
107
|
-
see_in_order "Loaded suite",
|
|
108
|
-
"THE SETUP",
|
|
109
|
-
"A FAILING TEST",
|
|
110
|
-
"F", "THE TEARDOWN",
|
|
111
|
-
"Finished in",
|
|
112
|
-
"1) Failure:",
|
|
113
|
-
"test_something(MyExampleTest) [_test_file_temp.rb:17]:",
|
|
114
|
-
"Instrumented failure.",
|
|
115
|
-
"<false> is not true."
|
|
116
|
-
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it "provides a cleaned-up backtrace, but not TOO cleaned up" do
|
|
120
|
-
write_and_run_test :with_failure => true, :use_helpers => true
|
|
121
|
-
see_in_order "Loaded suite",
|
|
122
|
-
"THE SETUP",
|
|
123
|
-
"A FAILING TEST",
|
|
124
|
-
"F", "THE TEARDOWN",
|
|
125
|
-
"Finished in",
|
|
126
|
-
"1) Failure:",
|
|
127
|
-
"test_something(MyExampleTest)\n",
|
|
128
|
-
"[_test_file_temp.rb:25:in `tripwire'",
|
|
129
|
-
"_test_file_temp.rb:21:in `my_helper'",
|
|
130
|
-
"_test_file_temp.rb:17:in `test_something']:",
|
|
131
|
-
"Instrumented failure.",
|
|
132
|
-
"<false> is not true."
|
|
133
|
-
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
|
|
134
|
-
end
|
|
135
|
-
|
|
136
|
-
should "not interfere with passthrough exception types" do
|
|
137
|
-
if is_modern_test_unit?
|
|
138
|
-
write_and_run_test :raise_nasty_in_test => true
|
|
139
|
-
see_in_no_particular_order "Loaded suite",
|
|
140
|
-
"THE TEARDOWN",
|
|
141
|
-
"_test_file_temp.rb:16:in `test_something': NASTY ERROR (NoMemoryError)"
|
|
142
|
-
see_no_results
|
|
143
|
-
end
|
|
144
|
-
end
|
|
145
|
-
|
|
146
|
-
#
|
|
147
|
-
# before_setup
|
|
148
|
-
#
|
|
149
|
-
|
|
150
|
-
it "adds TestCase.before_setup hook for prepending pre-setup actions" do
|
|
151
|
-
write_and_run_test :use_before_setup => true
|
|
152
|
-
see_in_order "Loaded suite",
|
|
153
|
-
"3rd before_setup",
|
|
154
|
-
"2nd before_setup",
|
|
155
|
-
"1st before_setup",
|
|
156
|
-
"THE SETUP",
|
|
157
|
-
"A TEST",
|
|
158
|
-
"THE TEARDOWN",
|
|
159
|
-
"Finished in"
|
|
160
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0
|
|
161
|
-
end
|
|
162
|
-
|
|
163
|
-
should "stop executing the test on the first failure withing a before_setup action" do
|
|
164
|
-
write_and_run_test :use_before_setup => true, :flunk_in_before_setup => true
|
|
165
|
-
see_in_order "Loaded suite",
|
|
166
|
-
"3rd before_setup",
|
|
167
|
-
"2nd before_setup",
|
|
168
|
-
"FTHE TEARDOWN",
|
|
169
|
-
"1) Failure:",
|
|
170
|
-
"test_something(MyExampleTest) [_test_file_temp.rb:10]:",
|
|
171
|
-
"Flunk in 2nd before_setup."
|
|
172
|
-
see_results :tests => 1, :assertions => 1, :failures => 1, :errors => 0
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
should "stop executing the test on the first error within a before_setup action" do
|
|
176
|
-
write_and_run_test :use_before_setup => true, :raise_in_before_setup => true
|
|
177
|
-
see_in_order "Loaded suite",
|
|
178
|
-
"3rd before_setup",
|
|
179
|
-
"2nd before_setup",
|
|
180
|
-
"ETHE TEARDOWN",
|
|
181
|
-
"Finished in",
|
|
182
|
-
"test_something(MyExampleTest):",
|
|
183
|
-
"RuntimeError: Error in 2nd before_setup",
|
|
184
|
-
"_test_file_temp.rb:10",
|
|
185
|
-
"/hardmock/lib/test_unit_before_after.rb:", ":in `call'"
|
|
186
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 1
|
|
187
|
-
end
|
|
188
|
-
|
|
189
|
-
it "will run before_setup actions in the absence of a regular setup" do
|
|
190
|
-
write_and_run_test :omit_setup => true, :use_before_setup => true
|
|
191
|
-
see_in_order "Loaded suite",
|
|
192
|
-
"3rd before_setup",
|
|
193
|
-
"2nd before_setup",
|
|
194
|
-
"1st before_setup",
|
|
195
|
-
"A TEST",
|
|
196
|
-
"THE TEARDOWN",
|
|
197
|
-
"Finished in"
|
|
198
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0
|
|
199
|
-
end
|
|
200
|
-
|
|
201
|
-
it "allows before_setup and after_teardown to be used at the same time" do
|
|
202
|
-
write_and_run_test :use_before_setup => true, :use_after_teardown => true
|
|
203
|
-
see_in_order "Loaded suite",
|
|
204
|
-
"3rd before_setup",
|
|
205
|
-
"2nd before_setup",
|
|
206
|
-
"1st before_setup",
|
|
207
|
-
"A TEST",
|
|
208
|
-
"THE TEARDOWN",
|
|
209
|
-
"1st after_teardown",
|
|
210
|
-
"2nd after_teardown",
|
|
211
|
-
"Finished in"
|
|
212
|
-
see_results :tests => 1, :assertions => 0, :failures => 0, :errors => 0
|
|
213
|
-
end
|
|
214
|
-
|
|
215
|
-
#
|
|
216
|
-
# HELPERS
|
|
217
|
-
#
|
|
218
|
-
|
|
219
|
-
def teardown
|
|
220
|
-
remove_test
|
|
221
|
-
end
|
|
222
|
-
|
|
223
|
-
def test_filename
|
|
224
|
-
"_test_file_temp.rb"
|
|
225
|
-
end
|
|
226
|
-
|
|
227
|
-
def remove_test
|
|
228
|
-
rm_f test_filename
|
|
229
|
-
end
|
|
230
|
-
|
|
231
|
-
def write_and_run_test(opts={})
|
|
232
|
-
write(test_filename, generate_test_code(opts))
|
|
233
|
-
run_test
|
|
234
|
-
end
|
|
235
|
-
|
|
236
|
-
def run_test
|
|
237
|
-
@output = `ruby #{test_filename} 2>&1`
|
|
238
|
-
end
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
def write(fname, code)
|
|
242
|
-
File.open(fname,"w") do |f|
|
|
243
|
-
f.print code
|
|
244
|
-
end
|
|
245
|
-
end
|
|
246
|
-
|
|
247
|
-
def show_output
|
|
248
|
-
puts "-- BEGIN TEST OUTPUT"
|
|
249
|
-
puts @output
|
|
250
|
-
puts "-- END TEST OUTPUT"
|
|
251
|
-
end
|
|
252
|
-
|
|
253
|
-
def see_in_order(*phrases)
|
|
254
|
-
idx = 0
|
|
255
|
-
phrases.each do |txt|
|
|
256
|
-
idx = @output.index(txt, idx)
|
|
257
|
-
if idx.nil?
|
|
258
|
-
if @output.index(txt)
|
|
259
|
-
flunk "Phrase '#{txt}' is out-of-order in test output:\n#{@output}"
|
|
260
|
-
else
|
|
261
|
-
flunk "Phrase '#{txt}' not found in test output:\n#{@output}"
|
|
262
|
-
end
|
|
263
|
-
end
|
|
264
|
-
end
|
|
265
|
-
end
|
|
266
|
-
|
|
267
|
-
def see_in_no_particular_order(*phrases)
|
|
268
|
-
phrases.each do |txt|
|
|
269
|
-
assert_not_nil @output.index(txt), "Didn't see '#{txt}' in test output:\n#{@output}"
|
|
270
|
-
end
|
|
271
|
-
end
|
|
272
|
-
|
|
273
|
-
def see_results(opts)
|
|
274
|
-
if @output =~ /(\d+) tests, (\d+) assertions, (\d+) failures, (\d+) errors/
|
|
275
|
-
tests, assertions, failures, errors = [ $1, $2, $3, $4 ]
|
|
276
|
-
[:tests, :assertions, :failures, :errors].each do |key|
|
|
277
|
-
eval %{assert_equal(opts[:#{key}].to_s, #{key}, "Wrong number of #{key} in report") if opts[:#{key}]}
|
|
278
|
-
end
|
|
279
|
-
else
|
|
280
|
-
flunk "Didn't see the test results report line"
|
|
281
|
-
end
|
|
282
|
-
end
|
|
283
|
-
|
|
284
|
-
def see_no_results
|
|
285
|
-
if @output =~ /\d+ tests, \d+ assertions, \d+ failures, \d+ errors/
|
|
286
|
-
flunk "Should not have had a results line:\n#{@output}"
|
|
287
|
-
end
|
|
288
|
-
end
|
|
289
|
-
|
|
290
|
-
def lib_dir
|
|
291
|
-
File.expand_path(File.dirname(__FILE__) + "/../../lib")
|
|
292
|
-
end
|
|
293
|
-
|
|
294
|
-
def generate_test_code(opts={})
|
|
295
|
-
|
|
296
|
-
if opts[:with_failure] or opts[:raise_nasty_in_test]
|
|
297
|
-
test_method_code = generate_failing_test("test_something", opts)
|
|
298
|
-
else
|
|
299
|
-
test_method_code = generate_passing_test("test_something")
|
|
300
|
-
end
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
requires_for_ext = ''
|
|
304
|
-
if opts[:use_before_setup] or opts[:use_after_teardown]
|
|
305
|
-
requires_for_ext =<<-RFE
|
|
306
|
-
$: << "#{lib_dir}"
|
|
307
|
-
require 'test_unit_before_after'
|
|
308
|
-
RFE
|
|
309
|
-
end
|
|
310
|
-
|
|
311
|
-
before_setups = ''
|
|
312
|
-
if opts[:use_before_setup]
|
|
313
|
-
add_on_two = ""
|
|
314
|
-
if opts[:flunk_in_before_setup]
|
|
315
|
-
add_on_two = %{; test.flunk "Flunk in 2nd before_setup"}
|
|
316
|
-
elsif opts[:raise_in_before_setup]
|
|
317
|
-
add_on_two = %{; raise "Error in 2nd before_setup"}
|
|
318
|
-
end
|
|
319
|
-
before_setups =<<-BSTS
|
|
320
|
-
Test::Unit::TestCase.before_setup do |test|
|
|
321
|
-
puts "1st before_setup"
|
|
322
|
-
end
|
|
323
|
-
Test::Unit::TestCase.before_setup do |test|
|
|
324
|
-
puts "2nd before_setup" #{add_on_two}
|
|
325
|
-
end
|
|
326
|
-
Test::Unit::TestCase.before_setup do |test|
|
|
327
|
-
puts "3rd before_setup"
|
|
328
|
-
end
|
|
329
|
-
|
|
330
|
-
BSTS
|
|
331
|
-
end
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
setup_code =<<-SC
|
|
335
|
-
def setup
|
|
336
|
-
puts "THE SETUP"
|
|
337
|
-
end
|
|
338
|
-
SC
|
|
339
|
-
if opts[:omit_setup]
|
|
340
|
-
setup_code = ""
|
|
341
|
-
end
|
|
342
|
-
|
|
343
|
-
after_teardowns = ''
|
|
344
|
-
if opts[:use_after_teardown]
|
|
345
|
-
add_on_one = ""
|
|
346
|
-
add_on_two = ""
|
|
347
|
-
if opts[:flunk_in_after_teardown]
|
|
348
|
-
add_on_one = %{; test.flunk "Flunk in first after_teardown"}
|
|
349
|
-
add_on_two = %{; test.flunk "Flunk in second after_teardown"}
|
|
350
|
-
elsif opts[:raise_in_after_teardown]
|
|
351
|
-
add_on_one = %{; raise "Error in first after_teardown"}
|
|
352
|
-
add_on_two = %{; raise "Error in second after_teardown"}
|
|
353
|
-
end
|
|
354
|
-
after_teardowns =<<-ATDS
|
|
355
|
-
Test::Unit::TestCase.after_teardown do |test|
|
|
356
|
-
puts "1st after_teardown" #{add_on_one}
|
|
357
|
-
end
|
|
358
|
-
Test::Unit::TestCase.after_teardown do |test|
|
|
359
|
-
puts "2nd after_teardown" #{add_on_two}
|
|
360
|
-
end
|
|
361
|
-
ATDS
|
|
362
|
-
end
|
|
363
|
-
|
|
364
|
-
teardown_code =<<-TDC
|
|
365
|
-
def teardown
|
|
366
|
-
puts "THE TEARDOWN"
|
|
367
|
-
end
|
|
368
|
-
TDC
|
|
369
|
-
if opts[:flunk_in_teardown]
|
|
370
|
-
teardown_code =<<-TDC
|
|
371
|
-
def teardown
|
|
372
|
-
flunk "FLUNK IN TEARDOWN"
|
|
373
|
-
end
|
|
374
|
-
TDC
|
|
375
|
-
elsif opts[:raise_in_teardown]
|
|
376
|
-
teardown_code =<<-TDC
|
|
377
|
-
def teardown
|
|
378
|
-
raise "ERROR IN TEARDOWN"
|
|
379
|
-
end
|
|
380
|
-
TDC
|
|
381
|
-
end
|
|
382
|
-
if opts[:omit_teardown]
|
|
383
|
-
teardown_code = ""
|
|
384
|
-
end
|
|
385
|
-
|
|
386
|
-
str = <<-TCODE
|
|
387
|
-
require 'test/unit'
|
|
388
|
-
#{requires_for_ext}
|
|
389
|
-
|
|
390
|
-
#{before_setups} #{after_teardowns}
|
|
391
|
-
|
|
392
|
-
class MyExampleTest < Test::Unit::TestCase
|
|
393
|
-
#{setup_code}
|
|
394
|
-
#{teardown_code}
|
|
395
|
-
#{test_method_code}
|
|
396
|
-
end
|
|
397
|
-
TCODE
|
|
398
|
-
end
|
|
399
|
-
|
|
400
|
-
def generate_passing_test(tname)
|
|
401
|
-
str = <<-TMETH
|
|
402
|
-
def #{tname}
|
|
403
|
-
puts "A TEST"
|
|
404
|
-
end
|
|
405
|
-
TMETH
|
|
406
|
-
end
|
|
407
|
-
|
|
408
|
-
def generate_failing_test(tname, opts={})
|
|
409
|
-
str = "NOT DEFINED?"
|
|
410
|
-
if opts[:raise_nasty_in_test]
|
|
411
|
-
str = <<-TMETH
|
|
412
|
-
def #{tname}
|
|
413
|
-
raise NoMemoryError, "NASTY ERROR"
|
|
414
|
-
end
|
|
415
|
-
TMETH
|
|
416
|
-
|
|
417
|
-
elsif opts[:use_helpers]
|
|
418
|
-
str = <<-TMETH
|
|
419
|
-
def #{tname}
|
|
420
|
-
puts "A FAILING TEST"
|
|
421
|
-
my_helper
|
|
422
|
-
end
|
|
423
|
-
|
|
424
|
-
def my_helper
|
|
425
|
-
tripwire
|
|
426
|
-
end
|
|
427
|
-
|
|
428
|
-
def tripwire
|
|
429
|
-
assert false, "Instrumented failure"
|
|
430
|
-
end
|
|
431
|
-
TMETH
|
|
432
|
-
else
|
|
433
|
-
str = <<-TMETH
|
|
434
|
-
def #{tname}
|
|
435
|
-
puts "A FAILING TEST"
|
|
436
|
-
assert false, "Instrumented failure"
|
|
437
|
-
end
|
|
438
|
-
TMETH
|
|
439
|
-
end
|
|
440
|
-
return str
|
|
441
|
-
end
|
|
442
|
-
|
|
443
|
-
def is_modern_test_unit?
|
|
444
|
-
begin
|
|
445
|
-
Test::Unit::TestCase::PASSTHROUGH_EXCEPTIONS
|
|
446
|
-
return true
|
|
447
|
-
rescue NameError
|
|
448
|
-
return false
|
|
449
|
-
end
|
|
450
|
-
end
|
|
451
|
-
|
|
452
|
-
end
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + "/../test_helper")
|
|
2
|
-
require 'hardmock/method_cleanout'
|
|
3
|
-
require 'hardmock/trapper'
|
|
4
|
-
|
|
5
|
-
class TrapperTest < Test::Unit::TestCase
|
|
6
|
-
include Hardmock
|
|
7
|
-
|
|
8
|
-
def setup
|
|
9
|
-
@mock = Object.new
|
|
10
|
-
@mock_control = MyControl.new
|
|
11
|
-
@builder = ExpBuilder.new
|
|
12
|
-
@trapper = Trapper.new(@mock, @mock_control, @builder)
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
#
|
|
16
|
-
# HELPERS
|
|
17
|
-
#
|
|
18
|
-
|
|
19
|
-
class MyControl
|
|
20
|
-
attr_reader :added
|
|
21
|
-
def add_expectation(expectation)
|
|
22
|
-
@added ||= []
|
|
23
|
-
@added << expectation
|
|
24
|
-
end
|
|
25
|
-
end
|
|
26
|
-
|
|
27
|
-
class ExpBuilder
|
|
28
|
-
attr_reader :options
|
|
29
|
-
def build_expectation(options)
|
|
30
|
-
@options = options
|
|
31
|
-
"dummy expectation"
|
|
32
|
-
end
|
|
33
|
-
end
|
|
34
|
-
|
|
35
|
-
#
|
|
36
|
-
# TESTS
|
|
37
|
-
#
|
|
38
|
-
|
|
39
|
-
def test_method_missing
|
|
40
|
-
|
|
41
|
-
output = @trapper.change(:less)
|
|
42
|
-
|
|
43
|
-
assert_same @mock, @builder.options[:mock]
|
|
44
|
-
assert_equal :change, @builder.options[:method]
|
|
45
|
-
assert_equal [:less], @builder.options[:arguments]
|
|
46
|
-
assert_not_nil @builder.options[:block]
|
|
47
|
-
assert @builder.options[:suppress_arguments_to_block], ":suppress_arguments_to_block should be set"
|
|
48
|
-
assert_equal [ "dummy expectation" ], @mock_control.added,
|
|
49
|
-
"Wrong expectation added to control"
|
|
50
|
-
|
|
51
|
-
assert_equal "dummy expectation", output, "Expectation should have been returned"
|
|
52
|
-
|
|
53
|
-
# Examine the block. It should take one argument and simply return
|
|
54
|
-
# that argument. because of the 'suppress arguments to block'
|
|
55
|
-
# setting, the argument can only end up being a block, in practice.
|
|
56
|
-
trapper_block = @builder.options[:block]
|
|
57
|
-
assert_equal "the argument", trapper_block.call("the argument"),
|
|
58
|
-
"The block should merely return the passed argument"
|
|
59
|
-
end
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
end
|