ceedling 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/GIT_COMMIT_SHA +1 -1
- data/Gemfile +7 -1
- data/Gemfile.lock +19 -12
- data/README.md +140 -156
- data/Rakefile +189 -9
- data/assets/example_file.c +1 -1
- data/assets/example_file.h +1 -1
- data/assets/example_file_call.c +1 -1
- data/assets/example_file_call.h +1 -1
- data/assets/example_file_with_statics.c +10 -0
- data/assets/example_file_with_stdio.c +13 -0
- data/assets/example_file_with_stdio.h +15 -0
- data/assets/project.yml +20 -18
- data/assets/test_example_file.c +1 -1
- data/assets/test_example_file_boom.c +1 -1
- data/assets/test_example_file_crash_assert.c +25 -0
- data/assets/{test_example_file_crash.c → test_example_file_crash_sigsegv.c} +4 -3
- data/assets/test_example_file_source_include.c +17 -0
- data/assets/test_example_file_success.c +1 -1
- data/assets/test_example_file_unity_printf.c +1 -1
- data/assets/test_example_file_verbose.c +1 -1
- data/assets/test_example_file_with_mock.c +1 -1
- data/assets/test_example_file_with_stdio.c +18 -0
- data/assets/test_example_with_parameterized_tests.c +1 -1
- data/assets/tests_with_defines/src/adc_hardware.c +1 -1
- data/assets/tests_with_defines/src/adc_hardware.h +1 -1
- data/assets/tests_with_defines/src/adc_hardware_configurator.c +1 -1
- data/assets/tests_with_defines/src/adc_hardware_configurator.h +1 -1
- data/assets/tests_with_defines/test/test_adc_hardware.c +1 -1
- data/assets/tests_with_defines/test/test_adc_hardware_special.c +1 -1
- data/assets/tests_with_encoding/src/unicoder.c +12 -0
- data/assets/tests_with_encoding/src/unicoder.h +14 -0
- data/assets/tests_with_encoding/test/test_unicoder.c +15 -0
- data/assets/tests_with_encoding/test/test_unicoder_partial.c +17 -0
- data/assets/tests_with_fallback_conditionals/src/conditional_module.c +18 -0
- data/assets/tests_with_fallback_conditionals/src/conditional_module.h +13 -0
- data/assets/tests_with_fallback_conditionals/src/optional_dep.h +12 -0
- data/assets/tests_with_fallback_conditionals/test/test_conditionals.c +49 -0
- data/assets/tests_with_preprocessing/src/adc_hardwareA.c +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardwareA.h +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardwareB.c +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardwareB.h +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardwareC.c +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardwareC.h +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardware_configuratorA.h +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardware_configuratorB.h +1 -1
- data/assets/tests_with_preprocessing/src/adc_hardware_configuratorC.h +1 -1
- data/assets/tests_with_preprocessing/test/test_adc_hardwareA.c +1 -1
- data/assets/tests_with_preprocessing/test/test_adc_hardwareB.c +1 -1
- data/assets/tests_with_preprocessing/test/test_adc_hardwareC.c +1 -1
- data/assets/uncovered_example_file.c +1 -1
- data/bin/actions_wrapper.rb +1 -1
- data/bin/app_cfg.rb +1 -1
- data/bin/ceedling +14 -3
- data/bin/cli.rb +110 -38
- data/bin/cli_handler.rb +167 -68
- data/bin/cli_helper.rb +179 -55
- data/bin/configinator.rb +71 -12
- data/bin/merginator.rb +82 -0
- data/bin/mixin_standardizer.rb +127 -0
- data/bin/mixinator.rb +199 -33
- data/bin/mixins.rb +4 -2
- data/bin/objects.yml +22 -1
- data/bin/path_validator.rb +1 -1
- data/bin/projectinator.rb +29 -20
- data/bin/rake_patches.rb +31 -0
- data/bin/recursive_merger.rb +128 -0
- data/bin/versionator.rb +2 -2
- data/ceedling.gemspec +31 -14
- data/config/test_environment.rb +1 -1
- data/docs/BreakingChanges.md +16 -3
- data/docs/Changelog.md +177 -6
- data/docs/KnownIssues.md +26 -0
- data/docs/ReleaseNotes.md +133 -19
- data/docs/mkdocs/assets/images/ceedling-logo-circle.png +0 -0
- data/docs/mkdocs/assets/images/ceedling.svg +90 -0
- data/docs/mkdocs/assets/images/favicon.png +0 -0
- data/docs/mkdocs/assets/stylesheets/admonitions.css +152 -0
- data/docs/mkdocs/assets/stylesheets/fixes-local.css +15 -0
- data/docs/mkdocs/assets/stylesheets/styling.css +102 -0
- data/docs/mkdocs/configuration/environment-vars.md +14 -0
- data/docs/mkdocs/configuration/global-collections.md +156 -0
- data/docs/mkdocs/configuration/index.md +75 -0
- data/docs/mkdocs/configuration/loading.md +89 -0
- data/docs/mkdocs/configuration/mixins.md +607 -0
- data/docs/mkdocs/configuration/parallel-builds.md +97 -0
- data/docs/mkdocs/configuration/project-file.md +198 -0
- data/docs/mkdocs/configuration/reference/cexception.md +35 -0
- data/docs/mkdocs/configuration/reference/cmock.md +106 -0
- data/docs/mkdocs/configuration/reference/defines.md +352 -0
- data/docs/mkdocs/configuration/reference/environment.md +55 -0
- data/docs/mkdocs/configuration/reference/extension.md +63 -0
- data/docs/mkdocs/configuration/reference/files.md +154 -0
- data/docs/mkdocs/configuration/reference/flags.md +296 -0
- data/docs/mkdocs/configuration/reference/index.md +168 -0
- data/docs/mkdocs/configuration/reference/libraries.md +82 -0
- data/docs/mkdocs/configuration/reference/mixins.md +24 -0
- data/docs/mkdocs/configuration/reference/paths.md +276 -0
- data/docs/mkdocs/configuration/reference/plugins.md +60 -0
- data/docs/mkdocs/configuration/reference/project.md +333 -0
- data/docs/mkdocs/configuration/reference/release-build.md +62 -0
- data/docs/mkdocs/configuration/reference/test-build.md +55 -0
- data/docs/mkdocs/configuration/reference/test-runner.md +61 -0
- data/docs/mkdocs/configuration/reference/tools.md +457 -0
- data/docs/mkdocs/configuration/reference/unity.md +49 -0
- data/docs/mkdocs/configuration/which-ceedling.md +77 -0
- data/docs/mkdocs/development/index.md +50 -0
- data/docs/mkdocs/development/plugins/configuration.md +164 -0
- data/docs/mkdocs/development/plugins/index.md +84 -0
- data/docs/{PluginDevelopmentGuide.md → mkdocs/development/plugins/plugin-subclass.md} +61 -312
- data/docs/mkdocs/development/plugins/rake-tasks.md +54 -0
- data/docs/mkdocs/development/workflow.md +284 -0
- data/docs/mkdocs/getting-started/command-line.md +477 -0
- data/docs/mkdocs/getting-started/example-projects/cipher-quest.md +65 -0
- data/docs/mkdocs/getting-started/example-projects/index.md +49 -0
- data/docs/mkdocs/getting-started/example-projects/temp-sensor.md +60 -0
- data/docs/mkdocs/getting-started/example-projects/wondrous-forest.md +45 -0
- data/docs/mkdocs/getting-started/index.md +41 -0
- data/docs/mkdocs/getting-started/installation.md +172 -0
- data/docs/mkdocs/getting-started/quick-start.md +65 -0
- data/docs/mkdocs/help.md +49 -0
- data/docs/mkdocs/index.md +215 -0
- data/docs/mkdocs/overview/build-system.md +115 -0
- data/docs/mkdocs/overview/index.md +29 -0
- data/docs/mkdocs/overview/test-environments.md +33 -0
- data/docs/mkdocs/overview/tools-and-frameworks.md +115 -0
- data/{plugins/beep/README.md → docs/mkdocs/plugins/beep.md} +10 -9
- data/{plugins/bullseye/README.md → docs/mkdocs/plugins/bullseye.md} +8 -12
- data/{plugins/command_hooks/README.md → docs/mkdocs/plugins/command-hooks.md} +69 -47
- data/{plugins/compile_commands_json_db/README.md → docs/mkdocs/plugins/compile-commands-json-db.md} +7 -5
- data/docs/mkdocs/plugins/cppcheck.md +377 -0
- data/{plugins/dependencies/README.md → docs/mkdocs/plugins/dependencies.md} +39 -50
- data/{plugins/fff/README.md → docs/mkdocs/plugins/fff.md} +42 -37
- data/docs/mkdocs/plugins/gcov/examples.md +92 -0
- data/docs/mkdocs/plugins/gcov/gcovr.md +251 -0
- data/docs/mkdocs/plugins/gcov/index.md +68 -0
- data/docs/mkdocs/plugins/gcov/overview.md +145 -0
- data/docs/mkdocs/plugins/gcov/reportgenerator.md +58 -0
- data/docs/mkdocs/plugins/gcov/reporting.md +147 -0
- data/docs/mkdocs/plugins/gcov/setup.md +232 -0
- data/docs/mkdocs/plugins/gcov/tool-versions.md +60 -0
- data/docs/mkdocs/plugins/gcov/troubleshooting.md +78 -0
- data/docs/mkdocs/plugins/index.md +221 -0
- data/{plugins/module_generator/README.md → docs/mkdocs/plugins/module-generator.md} +44 -44
- data/{plugins/report_build_warnings_log/README.md → docs/mkdocs/plugins/report-build-warnings-log.md} +6 -4
- data/{plugins/report_tests_gtestlike_stdout/README.md → docs/mkdocs/plugins/report-tests-gtestlike-stdout.md} +9 -7
- data/{plugins/report_tests_ide_stdout/README.md → docs/mkdocs/plugins/report-tests-ide-stdout.md} +8 -7
- data/{plugins/report_tests_log_factory/README.md → docs/mkdocs/plugins/report-tests-log-factory.md} +44 -36
- data/{plugins/report_tests_pretty_stdout/README.md → docs/mkdocs/plugins/report-tests-pretty-stdout.md} +8 -6
- data/{plugins/report_tests_raw_output_log/README.md → docs/mkdocs/plugins/report-tests-raw-output-log.md} +9 -7
- data/{plugins/report_tests_teamcity_stdout/README.md → docs/mkdocs/plugins/report-tests-teamcity-stdout.md} +8 -6
- data/docs/mkdocs/plugins/sample_html_report.png +0 -0
- data/docs/mkdocs/plugins/valgrind.md +192 -0
- data/docs/mkdocs/project/release-history.md +61 -0
- data/docs/{CeedlingUpgrade.md → mkdocs/project/upgrade.md} +9 -7
- data/docs/mkdocs/reference/build-directives.md +37 -0
- data/docs/mkdocs/reference/command-line.md +323 -0
- data/docs/mkdocs/reference/environment-vars.md +60 -0
- data/docs/mkdocs/reference/gcov-plugin.md +577 -0
- data/docs/mkdocs/reference/global-collections.md +160 -0
- data/docs/mkdocs/reference/index.md +65 -0
- data/docs/mkdocs/reference/partials-macros.md +79 -0
- data/docs/mkdocs/reference/project-configuration.md +46 -0
- data/docs/mkdocs/snapshot/assets/project.yml +404 -0
- data/docs/mkdocs/snapshot/examples/cipher_quest/README.md +210 -0
- data/docs/mkdocs/snapshot/examples/temp_sensor/README.md +283 -0
- data/docs/mkdocs/snapshot/examples/wondrous_forest/README.md +92 -0
- data/docs/mkdocs/snapshot/plugins/gcov/config/defaults.yml +33 -0
- data/docs/mkdocs/snapshot/plugins/gcov/config/defaults_gcov.rb +136 -0
- data/docs/mkdocs/snapshot.yml +20 -0
- data/docs/mkdocs/testing-guide/build-directives.md +153 -0
- data/docs/mkdocs/testing-guide/conventions.md +616 -0
- data/docs/mkdocs/testing-guide/frameworks.md +192 -0
- data/docs/mkdocs/testing-guide/index.md +80 -0
- data/docs/mkdocs/testing-guide/partials/configuration.md +67 -0
- data/docs/mkdocs/testing-guide/partials/conventions.md +68 -0
- data/docs/mkdocs/testing-guide/partials/directives.md +212 -0
- data/docs/mkdocs/testing-guide/partials/example.md +149 -0
- data/docs/mkdocs/testing-guide/partials/index.md +79 -0
- data/docs/mkdocs/testing-guide/partials/overview.md +81 -0
- data/docs/mkdocs/testing-guide/partials/variables.md +244 -0
- data/docs/mkdocs/testing-guide/test-cases.md +194 -0
- data/docs/mkdocs/testing-guide/test-sample.md +94 -0
- data/docs/mkdocs/testing-guide/test-suite-anatomy.md +58 -0
- data/examples/cipher_quest/README.md +210 -0
- data/examples/cipher_quest/mixin/release_analyze.yml +28 -0
- data/examples/cipher_quest/mixin/release_caesar.yml +28 -0
- data/examples/cipher_quest/mixin/release_full.yml +30 -0
- data/examples/cipher_quest/mixin/release_rot13.yml +28 -0
- data/examples/cipher_quest/project.yml +108 -0
- data/examples/cipher_quest/src/analyzer.c +83 -0
- data/examples/cipher_quest/src/analyzer.h +29 -0
- data/examples/cipher_quest/src/cipher.c +59 -0
- data/examples/cipher_quest/src/cipher.h +27 -0
- data/examples/cipher_quest/src/main.c +151 -0
- data/examples/cipher_quest/src/text_utils.c +119 -0
- data/examples/cipher_quest/src/text_utils.h +23 -0
- data/examples/cipher_quest/test/TestAnalyzer.c +133 -0
- data/examples/cipher_quest/test/TestCipherCaesar.c +81 -0
- data/examples/cipher_quest/test/TestCipherRot13.c +74 -0
- data/examples/cipher_quest/test/TestTextUtils.c +184 -0
- data/examples/temp_sensor/README.md +279 -14
- data/examples/temp_sensor/mixin/add_gcov.yml +1 -1
- data/examples/temp_sensor/mixin/add_unity_helper.yml +1 -1
- data/examples/temp_sensor/project.yml +4 -15
- data/examples/temp_sensor/src/AdcConductor.c +5 -1
- data/examples/temp_sensor/src/AdcConductor.h +1 -1
- data/examples/temp_sensor/src/AdcHardware.c +1 -1
- data/examples/temp_sensor/src/AdcHardware.h +1 -1
- data/examples/temp_sensor/src/AdcHardwareConfigurator.c +2 -1
- data/examples/temp_sensor/src/AdcHardwareConfigurator.h +1 -1
- data/examples/temp_sensor/src/AdcModel.c +2 -2
- data/examples/temp_sensor/src/AdcModel.h +1 -1
- data/examples/temp_sensor/src/AdcTemperatureSensor.c +2 -1
- data/examples/temp_sensor/src/AdcTemperatureSensor.h +1 -1
- data/examples/temp_sensor/src/Executor.c +1 -1
- data/examples/temp_sensor/src/Executor.h +1 -1
- data/examples/temp_sensor/src/IntrinsicsWrapper.c +1 -1
- data/examples/temp_sensor/src/IntrinsicsWrapper.h +1 -1
- data/examples/temp_sensor/src/Main.c +3 -3
- data/examples/temp_sensor/src/Main.h +1 -1
- data/examples/temp_sensor/src/Model.c +1 -1
- data/examples/temp_sensor/src/Model.h +1 -1
- data/examples/temp_sensor/src/ModelConfig.h +1 -1
- data/examples/temp_sensor/src/TaskScheduler.c +1 -1
- data/examples/temp_sensor/src/TaskScheduler.h +1 -1
- data/examples/temp_sensor/src/TemperatureFilter.c +1 -1
- data/examples/temp_sensor/src/TemperatureFilter.h +1 -1
- data/examples/temp_sensor/src/TimerConductor.c +1 -1
- data/examples/temp_sensor/src/TimerConductor.h +1 -1
- data/examples/temp_sensor/src/TimerConfigurator.c +2 -1
- data/examples/temp_sensor/src/TimerConfigurator.h +1 -1
- data/examples/temp_sensor/src/TimerHardware.c +1 -1
- data/examples/temp_sensor/src/TimerHardware.h +1 -1
- data/examples/temp_sensor/src/TimerInterruptConfigurator.c +2 -1
- data/examples/temp_sensor/src/TimerInterruptConfigurator.h +1 -1
- data/examples/temp_sensor/src/TimerInterruptHandler.c +2 -1
- data/examples/temp_sensor/src/TimerInterruptHandler.h +1 -1
- data/examples/temp_sensor/src/TimerModel.c +1 -1
- data/examples/temp_sensor/src/TimerModel.h +1 -1
- data/examples/temp_sensor/src/Types.h +5 -2
- data/examples/temp_sensor/src/UsartConductor.c +1 -1
- data/examples/temp_sensor/src/UsartConductor.h +1 -1
- data/examples/temp_sensor/src/UsartConfigurator.c +2 -1
- data/examples/temp_sensor/src/UsartConfigurator.h +1 -1
- data/examples/temp_sensor/src/UsartHardware.c +1 -1
- data/examples/temp_sensor/src/UsartHardware.h +1 -1
- data/examples/temp_sensor/src/UsartModel.c +2 -2
- data/examples/temp_sensor/src/UsartModel.h +1 -1
- data/examples/temp_sensor/src/UsartPutChar.c +2 -1
- data/examples/temp_sensor/src/UsartPutChar.h +1 -1
- data/examples/temp_sensor/src/UsartTransmitBufferStatus.c +2 -1
- data/examples/temp_sensor/src/UsartTransmitBufferStatus.h +1 -1
- data/examples/temp_sensor/src/{TemperatureCalculator.c → calculators/TemperatureCalculator.c} +1 -1
- data/examples/temp_sensor/src/{TemperatureCalculator.h → calculators/TemperatureCalculator.h} +1 -1
- data/examples/temp_sensor/src/{UsartBaudRateRegisterCalculator.c → calculators/UsartBaudRateRegisterCalculator.c} +1 -1
- data/examples/temp_sensor/src/{UsartBaudRateRegisterCalculator.h → calculators/UsartBaudRateRegisterCalculator.h} +1 -1
- data/examples/temp_sensor/test/TestExecutor.c +1 -1
- data/examples/temp_sensor/test/TestMain.c +5 -1
- data/examples/temp_sensor/test/TestModel.c +1 -1
- data/examples/temp_sensor/test/TestTaskScheduler.c +1 -1
- data/examples/temp_sensor/test/TestTemperatureCalculator.c +2 -2
- data/examples/temp_sensor/test/TestTemperatureFilter.c +5 -2
- data/examples/temp_sensor/test/TestTimerConductor.c +1 -1
- data/examples/temp_sensor/test/TestTimerHardware.c +1 -1
- data/examples/temp_sensor/test/TestTimerIntegrated.c +8 -4
- data/examples/temp_sensor/test/TestTimerModel.c +1 -1
- data/examples/temp_sensor/test/TestTimerPlatformStandin.c +154 -0
- data/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +1 -1
- data/examples/temp_sensor/test/TestUsartConductor.c +1 -1
- data/examples/temp_sensor/test/TestUsartHardware.c +1 -1
- data/examples/temp_sensor/test/TestUsartIntegrated.c +9 -5
- data/examples/temp_sensor/test/TestUsartModel.c +2 -2
- data/examples/temp_sensor/test/TestUsartPlatformStandin.c +145 -0
- data/examples/temp_sensor/test/adc/TestAdcConductor.c +1 -1
- data/examples/temp_sensor/test/adc/TestAdcHardware.c +1 -1
- data/examples/temp_sensor/test/adc/TestAdcModel.c +1 -1
- data/examples/temp_sensor/test/adc/TestAdcPlatformStandin.c +100 -0
- data/examples/temp_sensor/test/platform/at91sam7s256.c +25 -0
- data/examples/temp_sensor/test/platform/at91sam7s256.h +183 -0
- data/examples/temp_sensor/test/support/UnityHelper.c +1 -1
- data/examples/temp_sensor/test/support/UnityHelper.h +1 -1
- data/examples/wondrous_forest/README.md +92 -0
- data/{lib/ceedling/release_invoker_helper.rb → examples/wondrous_forest/mixin/add_gcov.yml} +14 -4
- data/examples/wondrous_forest/project.yml +86 -0
- data/examples/wondrous_forest/src/AlertManager.c +125 -0
- data/examples/wondrous_forest/src/AlertManager.h +30 -0
- data/examples/wondrous_forest/src/EventQueue.c +73 -0
- data/examples/wondrous_forest/src/EventQueue.h +22 -0
- data/examples/wondrous_forest/src/ForestMonitor.c +88 -0
- data/examples/wondrous_forest/src/ForestMonitor.h +18 -0
- data/examples/wondrous_forest/src/HumiditySensor.c +57 -0
- data/examples/wondrous_forest/src/HumiditySensor.h +17 -0
- data/examples/wondrous_forest/src/LightSensor.c +51 -0
- data/examples/wondrous_forest/src/LightSensor.h +18 -0
- data/examples/wondrous_forest/src/SensorHal.c +62 -0
- data/examples/wondrous_forest/src/SensorHal.h +19 -0
- data/examples/wondrous_forest/src/SoilMoisture.c +61 -0
- data/examples/wondrous_forest/src/SoilMoisture.h +19 -0
- data/examples/wondrous_forest/src/TemperatureSensor.c +67 -0
- data/examples/wondrous_forest/src/TemperatureSensor.h +18 -0
- data/examples/wondrous_forest/src/Types.h +84 -0
- data/examples/wondrous_forest/src/UartDriver.c +55 -0
- data/examples/wondrous_forest/src/UartDriver.h +18 -0
- data/examples/wondrous_forest/test/TestAlertManager.c +105 -0
- data/examples/wondrous_forest/test/TestEventQueue.c +117 -0
- data/examples/wondrous_forest/test/TestForestMonitor.c +118 -0
- data/examples/wondrous_forest/test/TestHumiditySensor.c +85 -0
- data/examples/wondrous_forest/test/TestLightSensor.c +79 -0
- data/examples/wondrous_forest/test/TestSensorHal.c +58 -0
- data/examples/wondrous_forest/test/TestSoilMoisture.c +96 -0
- data/examples/wondrous_forest/test/TestTemperatureSensor.c +100 -0
- data/examples/wondrous_forest/test/TestUartDriver.c +55 -0
- data/lib/ceedling/application.rb +1 -1
- data/lib/ceedling/array_patches.rb +28 -0
- data/lib/ceedling/batchinator.rb +76 -0
- data/lib/ceedling/c_extractor/c_extractor.rb +340 -0
- data/lib/ceedling/c_extractor/c_extractor_code_text.rb +283 -0
- data/lib/ceedling/c_extractor/c_extractor_constants.rb +38 -0
- data/lib/ceedling/c_extractor/c_extractor_declarations.rb +415 -0
- data/lib/ceedling/c_extractor/c_extractor_definitions.rb +157 -0
- data/lib/ceedling/c_extractor/c_extractor_functions.rb +402 -0
- data/lib/ceedling/c_extractor/c_extractor_preprocessing.rb +262 -0
- data/lib/ceedling/c_extractor/c_extractor_types.rb +122 -0
- data/lib/ceedling/cacheinator.rb +1 -1
- data/lib/ceedling/cacheinator_helper.rb +23 -4
- data/lib/ceedling/ceedling.h +40 -0
- data/lib/ceedling/{config_matchinator.rb → config/config_matchinator.rb} +67 -5
- data/lib/ceedling/{config_walkinator.rb → config/config_walkinator.rb} +1 -1
- data/lib/ceedling/{configurator.rb → config/configurator.rb} +269 -107
- data/lib/ceedling/{configurator_builder.rb → config/configurator_builder.rb} +25 -6
- data/lib/ceedling/{configurator_plugins.rb → config/configurator_plugins.rb} +2 -4
- data/lib/ceedling/{configurator_setup.rb → config/configurator_setup.rb} +39 -71
- data/lib/ceedling/{configurator_validator.rb → config/configurator_validator.rb} +1 -1
- data/lib/ceedling/constants.rb +59 -18
- data/lib/ceedling/defaults.rb +31 -44
- data/lib/ceedling/defineinator.rb +2 -2
- data/lib/ceedling/dependinator.rb +1 -1
- data/lib/ceedling/encodinator.rb +1 -1
- data/lib/ceedling/erb_wrapper.rb +1 -1
- data/lib/ceedling/exceptions.rb +23 -3
- data/lib/ceedling/file_finder.rb +39 -10
- data/lib/ceedling/file_finder_helper.rb +2 -2
- data/lib/ceedling/file_path_collection_utils.rb +37 -23
- data/lib/ceedling/file_path_utils.rb +183 -26
- data/lib/ceedling/file_system_wrapper.rb +1 -1
- data/lib/ceedling/file_wrapper.rb +14 -1
- data/lib/ceedling/flaginator.rb +1 -1
- data/lib/ceedling/{generator.rb → generators/generator.rb} +86 -23
- data/lib/ceedling/{generator_helper.rb → generators/generator_helper.rb} +17 -11
- data/lib/ceedling/{generator_mocks.rb → generators/generator_mocks.rb} +1 -1
- data/lib/ceedling/generators/generator_partials.rb +177 -0
- data/lib/ceedling/{generator_test_results.rb → generators/generator_test_results.rb} +43 -17
- data/lib/ceedling/generators/generator_test_results_backtrace.rb +290 -0
- data/lib/ceedling/{generator_test_results_sanity_checker.rb → generators/generator_test_results_sanity_checker.rb} +1 -1
- data/lib/ceedling/generators/generator_test_runner.rb +97 -0
- data/lib/ceedling/includes/include_factory.rb +43 -0
- data/lib/ceedling/{include_pathinator.rb → includes/include_pathinator.rb} +1 -1
- data/lib/ceedling/includes/includes.rb +341 -0
- data/lib/ceedling/loginator.rb +115 -12
- data/lib/ceedling/makefile.rb +1 -1
- data/lib/ceedling/objects.yml +145 -43
- data/lib/ceedling/parsing_parcels.rb +35 -9
- data/lib/ceedling/partials/partializer.rb +444 -0
- data/lib/ceedling/partials/partializer_config.rb +217 -0
- data/lib/ceedling/partials/partializer_helper.rb +344 -0
- data/lib/ceedling/partials/partializer_runtime.rb +29 -0
- data/lib/ceedling/partials/partializer_utils.rb +222 -0
- data/lib/ceedling/partials/partials.rb +82 -0
- data/lib/ceedling/{plugin.rb → plugins/plugin.rb} +1 -1
- data/lib/ceedling/{plugin_manager.rb → plugins/plugin_manager.rb} +47 -21
- data/lib/ceedling/{plugin_manager_helper.rb → plugins/plugin_manager_helper.rb} +1 -1
- data/lib/ceedling/{plugin_reportinator.rb → plugins/plugin_reportinator.rb} +10 -18
- data/lib/ceedling/{plugin_reportinator_helper.rb → plugins/plugin_reportinator_helper.rb} +22 -26
- data/lib/ceedling/plugins/report_tests_stdout_plugin.rb +88 -0
- data/lib/ceedling/preprocess/README.md +184 -0
- data/lib/ceedling/preprocess/c_comment_scanner.rb +194 -0
- data/lib/ceedling/preprocess/c_preprocessor_conditionals.rb +170 -0
- data/lib/ceedling/preprocess/preprocessinator.rb +605 -0
- data/lib/ceedling/preprocess/preprocessinator_bare_includes_extractor.rb +69 -0
- data/lib/ceedling/preprocess/preprocessinator_code_finder.rb +150 -0
- data/lib/ceedling/preprocess/preprocessinator_comment_stripper.rb +80 -0
- data/lib/ceedling/preprocess/preprocessinator_file_assembler.rb +378 -0
- data/lib/ceedling/preprocess/preprocessinator_includes_handler.rb +224 -0
- data/lib/ceedling/preprocess/preprocessinator_line_marker_includes_extractor.rb +215 -0
- data/lib/ceedling/preprocess/preprocessinator_reconstructor.rb +398 -0
- data/lib/ceedling/rake_app/rake_invocation_tracker.rb +39 -0
- data/lib/ceedling/rake_app/rake_task_registry.rb +210 -0
- data/lib/ceedling/{rake_utils.rb → rake_app/rake_utils.rb} +1 -1
- data/lib/ceedling/{rake_wrapper.rb → rake_app/rake_wrapper.rb} +1 -1
- data/lib/ceedling/rake_app/rakefile_component_resolver.rb +77 -0
- data/lib/ceedling/rakefile.rb +16 -8
- data/lib/ceedling/release_invoker.rb +48 -4
- data/lib/ceedling/reportinator.rb +39 -18
- data/lib/ceedling/ruby_expandinator.rb +61 -0
- data/lib/ceedling/rules_release.rake +4 -2
- data/lib/ceedling/rules_tests.rake +1 -23
- data/lib/ceedling/setupinator.rb +23 -11
- data/lib/ceedling/stream_wrapper.rb +1 -1
- data/lib/ceedling/system_utils.rb +1 -1
- data/lib/ceedling/system_wrapper.rb +18 -21
- data/lib/ceedling/tasks_base.rake +3 -3
- data/lib/ceedling/tasks_filesystem.rake +22 -12
- data/lib/ceedling/tasks_release.rake +11 -18
- data/lib/ceedling/tasks_tests.rake +1 -1
- data/lib/ceedling/test_context_extractor.rb +178 -109
- data/lib/ceedling/test_invoker/test_build_executor.rb +661 -0
- data/lib/ceedling/test_invoker/test_build_planner.rb +277 -0
- data/lib/ceedling/test_invoker/test_build_setup.rb +441 -0
- data/lib/ceedling/test_invoker/test_invoker.rb +251 -0
- data/lib/ceedling/test_invoker/test_invoker_types.rb +56 -0
- data/lib/ceedling/test_runner_manager.rb +1 -1
- data/lib/ceedling/tool_executor.rb +29 -19
- data/lib/ceedling/tool_executor_helper.rb +7 -15
- data/lib/ceedling/tool_validator.rb +24 -8
- data/lib/ceedling/verbosinator.rb +1 -1
- data/lib/ceedling/yaml_wrapper.rb +72 -12
- data/lib/ceedling.rb +1 -1
- data/lib/snapshot.rb +43 -0
- data/lib/version.rb +2 -2
- data/license.txt +1 -1
- data/mkdocs.local.yml +45 -0
- data/mkdocs.yml +202 -0
- data/plugins/beep/config/defaults.yml +1 -1
- data/plugins/beep/config/defaults_beep.rb +1 -1
- data/plugins/beep/lib/beep.rb +7 -5
- data/plugins/bullseye/assets/template.erb +1 -1
- data/plugins/bullseye/bullseye.rake +1 -1
- data/plugins/bullseye/config/defaults.yml +1 -1
- data/plugins/bullseye/lib/bullseye.rb +9 -9
- data/plugins/command_hooks/lib/command_hooks.rb +43 -38
- data/plugins/compile_commands_json_db/lib/compile_commands_json_db.rb +2 -2
- data/plugins/cppcheck/AUTHORS.md +8 -0
- data/plugins/cppcheck/config/defaults.yml +44 -0
- data/plugins/cppcheck/config/defaults_cppcheck.rb +32 -0
- data/plugins/cppcheck/cppcheck.rake +54 -0
- data/plugins/cppcheck/lib/cppcheck.rb +247 -0
- data/plugins/cppcheck/lib/cppcheck_constants.rb +20 -0
- data/plugins/cppcheck/lib/cppcheck_reports.rb +160 -0
- data/plugins/dependencies/Rakefile +1 -1
- data/plugins/dependencies/config/defaults.yml +1 -1
- data/plugins/dependencies/dependencies.rake +3 -3
- data/plugins/dependencies/example/boss/project.yml +1 -3
- data/plugins/dependencies/example/boss/src/boss.c +1 -1
- data/plugins/dependencies/example/boss/src/boss.h +1 -1
- data/plugins/dependencies/example/boss/src/main.c +1 -1
- data/plugins/dependencies/example/boss/test/test_boss.c +1 -1
- data/plugins/dependencies/example/supervisor/project.yml +1 -3
- data/plugins/dependencies/example/supervisor/src/supervisor.c +1 -1
- data/plugins/dependencies/example/supervisor/src/supervisor.h +1 -1
- data/plugins/dependencies/example/supervisor/test/test_supervisor.c +1 -1
- data/plugins/dependencies/lib/dependencies.rb +14 -2
- data/plugins/fff/Rakefile +1 -1
- data/plugins/fff/config/fff.yml +1 -1
- data/plugins/fff/examples/fff_example/project.yml +2 -2
- data/plugins/fff/examples/fff_example/src/bar.c +1 -1
- data/plugins/fff/examples/fff_example/src/bar.h +1 -1
- data/plugins/fff/examples/fff_example/src/custom_types.h +1 -1
- data/plugins/fff/examples/fff_example/src/display.c +1 -1
- data/plugins/fff/examples/fff_example/src/display.h +1 -1
- data/plugins/fff/examples/fff_example/src/event_processor.c +1 -1
- data/plugins/fff/examples/fff_example/src/event_processor.h +1 -1
- data/plugins/fff/examples/fff_example/src/foo.c +1 -1
- data/plugins/fff/examples/fff_example/src/foo.h +1 -1
- data/plugins/fff/examples/fff_example/src/subfolder/zzz.c +1 -1
- data/plugins/fff/examples/fff_example/src/subfolder/zzz.h +1 -1
- data/plugins/fff/examples/fff_example/test/test_event_processor.c +1 -1
- data/plugins/fff/examples/fff_example/test/test_foo.c +1 -1
- data/plugins/fff/lib/fff.rb +10 -5
- data/plugins/fff/lib/fff_mock_generator.rb +1 -1
- data/plugins/fff/spec/fff_mock_header_generator_spec.rb +1 -1
- data/plugins/fff/spec/fff_mock_source_generator_spec.rb +1 -1
- data/plugins/fff/spec/header_generator.rb +1 -1
- data/plugins/fff/spec/spec_helper.rb +1 -1
- data/plugins/fff/src/fff_unity_helper.h +1 -1
- data/plugins/gcov/config/defaults.yml +4 -1
- data/plugins/gcov/config/defaults_gcov.rb +40 -13
- data/plugins/gcov/gcov.rake +31 -1
- data/plugins/gcov/lib/console_reportinator.rb +180 -0
- data/plugins/gcov/lib/gcov.rb +189 -103
- data/plugins/gcov/lib/gcov_constants.rb +16 -4
- data/plugins/gcov/lib/gcov_reportinator.rb +63 -0
- data/{spec/configurator_helper_spec.rb → plugins/gcov/lib/gcov_types.rb} +2 -6
- data/plugins/gcov/lib/gcovr_reportinator.rb +237 -136
- data/plugins/gcov/lib/reportgenerator_reportinator.rb +242 -116
- data/plugins/module_generator/Rakefile +1 -1
- data/plugins/module_generator/assets/stubby1.h +1 -1
- data/plugins/module_generator/assets/stubby2.h +1 -1
- data/plugins/module_generator/config/module_generator.yml +1 -1
- data/plugins/module_generator/example/project.yml +1 -3
- data/plugins/module_generator/lib/module_generator.rb +2 -2
- data/plugins/module_generator/module_generator.rake +1 -1
- data/plugins/report_build_warnings_log/lib/report_build_warnings_log.rb +14 -20
- data/plugins/report_tests_gtestlike_stdout/assets/template.erb +3 -3
- data/plugins/report_tests_gtestlike_stdout/config/report_tests_gtestlike_stdout.yml +1 -1
- data/plugins/report_tests_gtestlike_stdout/lib/report_tests_gtestlike_stdout.rb +4 -61
- data/plugins/report_tests_ide_stdout/config/report_tests_ide_stdout.yml +1 -1
- data/plugins/report_tests_ide_stdout/lib/report_tests_ide_stdout.rb +7 -60
- data/plugins/report_tests_log_factory/config/defaults.yml +1 -1
- data/plugins/report_tests_log_factory/lib/cppunit_tests_reporter.rb +5 -5
- data/plugins/report_tests_log_factory/lib/html_tests_reporter.rb +302 -133
- data/plugins/report_tests_log_factory/lib/json_tests_reporter.rb +9 -7
- data/plugins/report_tests_log_factory/lib/junit_tests_reporter.rb +6 -5
- data/plugins/report_tests_log_factory/lib/report_tests_log_factory.rb +72 -36
- data/plugins/report_tests_log_factory/lib/tests_reporter.rb +8 -8
- data/plugins/report_tests_pretty_stdout/assets/template.erb +1 -2
- data/plugins/report_tests_pretty_stdout/config/report_tests_pretty_stdout.yml +1 -1
- data/plugins/report_tests_pretty_stdout/lib/report_tests_pretty_stdout.rb +4 -65
- data/plugins/report_tests_raw_output_log/lib/report_tests_raw_output_log.rb +4 -4
- data/plugins/report_tests_teamcity_stdout/config/defaults.yml +1 -1
- data/plugins/report_tests_teamcity_stdout/config/report_tests_teamcity_stdout.yml +1 -1
- data/plugins/report_tests_teamcity_stdout/lib/report_tests_teamcity_stdout.rb +2 -2
- data/plugins/valgrind/config/defaults.yml +19 -0
- data/plugins/valgrind/config/defaults_valgrind.rb +20 -0
- data/plugins/valgrind/lib/valgrind.rb +132 -0
- data/plugins/valgrind/lib/valgrind_constants.rb +13 -0
- data/plugins/valgrind/valgrind.rake +87 -0
- data/site-local/404.html +4002 -0
- data/site-local/assets/images/ceedling-logo-circle.png +0 -0
- data/site-local/assets/images/ceedling.svg +90 -0
- data/site-local/assets/images/favicon.png +0 -0
- data/site-local/assets/javascripts/bundle.79ae519e.min.js +16 -0
- data/site-local/assets/javascripts/bundle.79ae519e.min.js.map +7 -0
- data/site-local/assets/javascripts/lunr/min/lunr.ar.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.da.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.de.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.du.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.el.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.es.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.fi.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.fr.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.he.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.hi.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.hu.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.hy.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.it.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.ja.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.jp.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.kn.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.ko.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.multi.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.nl.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.no.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.pt.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.ro.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.ru.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.sa.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.sv.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.ta.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.te.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.th.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.tr.min.js +18 -0
- data/site-local/assets/javascripts/lunr/min/lunr.vi.min.js +1 -0
- data/site-local/assets/javascripts/lunr/min/lunr.zh.min.js +1 -0
- data/site-local/assets/javascripts/lunr/tinyseg.js +206 -0
- data/site-local/assets/javascripts/lunr/wordcut.js +6708 -0
- data/site-local/assets/javascripts/workers/search.2c215733.min.js +42 -0
- data/site-local/assets/javascripts/workers/search.2c215733.min.js.map +7 -0
- data/site-local/assets/stylesheets/admonitions.css +152 -0
- data/site-local/assets/stylesheets/fixes-local.css +15 -0
- data/site-local/assets/stylesheets/main.484c7ddc.min.css +1 -0
- data/site-local/assets/stylesheets/main.484c7ddc.min.css.map +1 -0
- data/site-local/assets/stylesheets/palette.ab4e12ef.min.css +1 -0
- data/site-local/assets/stylesheets/palette.ab4e12ef.min.css.map +1 -0
- data/site-local/assets/stylesheets/styling.css +102 -0
- data/site-local/configuration/environment-vars.html +4102 -0
- data/site-local/configuration/global-collections.html +4248 -0
- data/site-local/configuration/index.html +4169 -0
- data/site-local/configuration/loading.html +4348 -0
- data/site-local/configuration/mixins.html +5060 -0
- data/site-local/configuration/parallel-builds.html +4347 -0
- data/site-local/configuration/project-file.html +4474 -0
- data/site-local/configuration/reference/cexception.html +4225 -0
- data/site-local/configuration/reference/cmock.html +4401 -0
- data/site-local/configuration/reference/defines.html +4734 -0
- data/site-local/configuration/reference/environment.html +4242 -0
- data/site-local/configuration/reference/extension.html +4387 -0
- data/site-local/configuration/reference/files.html +4541 -0
- data/site-local/configuration/reference/flags.html +4681 -0
- data/site-local/configuration/reference/index.html +4290 -0
- data/site-local/configuration/reference/libraries.html +4365 -0
- data/site-local/configuration/reference/mixins.html +4195 -0
- data/site-local/configuration/reference/paths.html +4714 -0
- data/site-local/configuration/reference/plugins.html +4262 -0
- data/site-local/configuration/reference/project.html +4777 -0
- data/site-local/configuration/reference/release-build.html +4287 -0
- data/site-local/configuration/reference/test-build.html +4264 -0
- data/site-local/configuration/reference/test-runner.html +4289 -0
- data/site-local/configuration/reference/tools.html +5120 -0
- data/site-local/configuration/reference/unity.html +4255 -0
- data/site-local/configuration/which-ceedling.html +4269 -0
- data/site-local/development/index.html +4148 -0
- data/site-local/development/plugins/configuration.html +4446 -0
- data/site-local/development/plugins/index.html +4212 -0
- data/site-local/development/plugins/plugin-subclass.html +5068 -0
- data/site-local/development/plugins/rake-tasks.html +4236 -0
- data/site-local/development/workflow.html +4664 -0
- data/site-local/getting-started/command-line.html +5498 -0
- data/site-local/getting-started/example-projects/cipher-quest.html +4272 -0
- data/site-local/getting-started/example-projects/index.html +4173 -0
- data/site-local/getting-started/example-projects/temp-sensor.html +4322 -0
- data/site-local/getting-started/example-projects/wondrous-forest.html +4290 -0
- data/site-local/getting-started/index.html +4116 -0
- data/site-local/getting-started/installation.html +4452 -0
- data/site-local/getting-started/quick-start.html +4262 -0
- data/site-local/help.html +4081 -0
- data/site-local/index.html +4364 -0
- data/site-local/overview/build-system.html +4288 -0
- data/site-local/overview/index.html +4103 -0
- data/site-local/overview/test-environments.html +4116 -0
- data/site-local/overview/tools-and-frameworks.html +4433 -0
- data/site-local/plugins/beep.html +4413 -0
- data/site-local/plugins/bullseye.html +4249 -0
- data/site-local/plugins/command-hooks.html +5023 -0
- data/site-local/plugins/compile-commands-json-db.html +4243 -0
- data/site-local/plugins/cppcheck.html +4851 -0
- data/site-local/plugins/dependencies.html +4828 -0
- data/site-local/plugins/fff.html +4661 -0
- data/site-local/plugins/gcov/examples.html +4293 -0
- data/site-local/plugins/gcov/gcovr.html +4512 -0
- data/site-local/plugins/gcov/index.html +4150 -0
- data/site-local/plugins/gcov/overview.html +4410 -0
- data/site-local/plugins/gcov/reportgenerator.html +4164 -0
- data/site-local/plugins/gcov/reporting.html +4336 -0
- data/site-local/plugins/gcov/setup.html +4597 -0
- data/site-local/plugins/gcov/tool-versions.html +4269 -0
- data/site-local/plugins/gcov/troubleshooting.html +4313 -0
- data/site-local/plugins/index.html +4348 -0
- data/site-local/plugins/module-generator.html +4588 -0
- data/site-local/plugins/report-build-warnings-log.html +4229 -0
- data/site-local/plugins/report-tests-gtestlike-stdout.html +4357 -0
- data/site-local/plugins/report-tests-ide-stdout.html +4270 -0
- data/site-local/plugins/report-tests-log-factory.html +4792 -0
- data/site-local/plugins/report-tests-pretty-stdout.html +4265 -0
- data/site-local/plugins/report-tests-raw-output-log.html +4292 -0
- data/site-local/plugins/report-tests-teamcity-stdout.html +4291 -0
- data/site-local/plugins/sample_html_report.png +0 -0
- data/site-local/plugins/valgrind.html +4605 -0
- data/site-local/project/release-history.html +4225 -0
- data/site-local/project/upgrade.html +4314 -0
- data/site-local/reference/build-directives.html +4210 -0
- data/site-local/reference/command-line.html +4989 -0
- data/site-local/reference/environment-vars.html +4278 -0
- data/site-local/reference/gcov-plugin.html +5886 -0
- data/site-local/reference/global-collections.html +4385 -0
- data/site-local/reference/index.html +4126 -0
- data/site-local/reference/partials-macros.html +4326 -0
- data/site-local/reference/project-configuration.html +4253 -0
- data/site-local/sitemap.xml +3 -0
- data/site-local/sitemap.xml.gz +0 -0
- data/site-local/snapshot/assets/project.yml +404 -0
- data/site-local/snapshot/examples/cipher_quest/index.html +4292 -0
- data/site-local/snapshot/examples/temp_sensor/index.html +4416 -0
- data/site-local/snapshot/examples/wondrous_forest/index.html +4200 -0
- data/site-local/snapshot/plugins/gcov/config/defaults.yml +33 -0
- data/site-local/snapshot/plugins/gcov/config/defaults_gcov.rb +136 -0
- data/site-local/testing-guide/build-directives.html +4481 -0
- data/site-local/testing-guide/conventions.html +5233 -0
- data/site-local/testing-guide/frameworks.html +4488 -0
- data/site-local/testing-guide/index.html +4174 -0
- data/site-local/testing-guide/partials/configuration.html +4347 -0
- data/site-local/testing-guide/partials/conventions.html +4327 -0
- data/site-local/testing-guide/partials/directives.html +4680 -0
- data/site-local/testing-guide/partials/example.html +4448 -0
- data/site-local/testing-guide/partials/index.html +4167 -0
- data/site-local/testing-guide/partials/overview.html +4322 -0
- data/site-local/testing-guide/partials/variables.html +4548 -0
- data/site-local/testing-guide/test-cases.html +4436 -0
- data/site-local/testing-guide/test-sample.html +4265 -0
- data/site-local/testing-guide/test-suite-anatomy.html +4249 -0
- data/spec/manual/stress_test.rb +1 -1
- data/spec/support/other_target.yml +1 -1
- data/spec/support/spec_helper.rb +20 -0
- data/spec/support/system/gem_dir_layout.rb +20 -0
- data/spec/support/system/spec_system_helper.rb +206 -0
- data/spec/support/system/system_context.rb +310 -0
- data/spec/support/system/system_test_output.rb +28 -0
- data/spec/support/target.yml +1 -1
- data/spec/system/cppcheck_deployment_spec.rb +49 -0
- data/spec/system/deployment_as_gem_spec.rb +86 -48
- data/spec/system/deployment_as_vendor_spec.rb +141 -79
- data/spec/system/encoding_stress_spec.rb +153 -0
- data/spec/system/example_cipher_quest_spec.rb +186 -0
- data/spec/system/example_temp_sensor_spec.rb +41 -35
- data/spec/system/example_wondrous_forest_spec.rb +117 -0
- data/spec/{gcov → system}/gcov_deployment_spec.rb +55 -26
- data/spec/system/mixin_ordering_spec.rb +548 -0
- data/spec/system/preprocessing_encoding_spec.rb +114 -0
- data/spec/system/preprocessing_fallback_conditionals_spec.rb +166 -0
- data/spec/system/preprocessing_locale_spec.rb +153 -0
- data/spec/system/preprocessing_parameterized_tests_spec.rb +183 -0
- data/spec/system/ruby_replacement_spec.rb +141 -0
- data/spec/{spec_system_helper.rb → system/support/common_test_cases.rb} +301 -350
- data/spec/system/support/cppcheck_common_test_cases.rb +98 -0
- data/spec/system/support/cppcheck_helpers.rb +27 -0
- data/spec/{gcov/gcov_test_cases_spec.rb → system/support/gcov_common_test_cases.rb} +224 -111
- data/spec/system/support/gcov_helpers.rb +81 -0
- data/spec/system/support/valgrind_common_test_cases.rb +120 -0
- data/spec/system/support/valgrind_helpers.rb +21 -0
- data/spec/system/upgrade_as_vendor_spec.rb +74 -39
- data/spec/system/valgrind_deployment_spec.rb +53 -0
- data/spec/units/bin/cli_helper_spec.rb +69 -0
- data/spec/units/bin/merginator_spec.rb +279 -0
- data/spec/units/bin/mixin_standardizer_spec.rb +231 -0
- data/spec/units/bin/mixinator_spec.rb +583 -0
- data/spec/units/bin/projectinator_mixin_spec.rb +362 -0
- data/spec/units/bin/recursive_merger_spec.rb +241 -0
- data/spec/units/c_extractor/c_extractor_code_text_spec.rb +2091 -0
- data/spec/units/c_extractor/c_extractor_declarations_spec.rb +746 -0
- data/spec/units/c_extractor/c_extractor_definitions_spec.rb +417 -0
- data/spec/units/c_extractor/c_extractor_functions_spec.rb +2742 -0
- data/spec/units/c_extractor/c_extractor_integration_spec.rb +935 -0
- data/spec/units/c_extractor/c_extractor_preprocessing_spec.rb +497 -0
- data/spec/units/c_extractor/c_extractor_spec.rb +356 -0
- data/spec/units/config_matchinator_spec.rb +401 -0
- data/spec/{config_walkinator_spec.rb → units/config_walkinator_spec.rb} +2 -2
- data/spec/{configurator_builder_spec.rb → units/configurator_builder_spec.rb} +1 -1
- data/spec/units/configurator_spec.rb +187 -0
- data/spec/{file_finder_helper_spec.rb → units/file_finder_helper_spec.rb} +1 -1
- data/spec/units/file_path_collection_utils_spec.rb +222 -0
- data/spec/units/file_path_utils_spec.rb +274 -0
- data/spec/units/generators/generator_helper_spec.rb +112 -0
- data/spec/units/generators/generator_partials_spec.rb +795 -0
- data/spec/units/generators/generator_test_results_backtrace_spec.rb +492 -0
- data/spec/{generator_test_results_sanity_checker_spec.rb → units/generators/generator_test_results_sanity_checker_spec.rb} +5 -4
- data/spec/units/generators/generator_test_results_spec.rb +412 -0
- data/spec/units/generators/generator_test_runner_spec.rb +120 -0
- data/spec/units/includes/include_spec.rb +716 -0
- data/spec/units/includes/includes_spec.rb +1069 -0
- data/spec/units/parsing_parcels_spec.rb +139 -0
- data/spec/units/partials/partializer_config_spec.rb +388 -0
- data/spec/units/partials/partializer_helper_spec.rb +992 -0
- data/spec/units/partials/partializer_spec.rb +1629 -0
- data/spec/units/partials/partializer_utils_spec.rb +587 -0
- data/spec/units/plugin_manager_spec.rb +48 -0
- data/spec/units/plugins/cppcheck_spec.rb +557 -0
- data/spec/units/preprocess/c_comment_scanner_spec.rb +409 -0
- data/spec/units/preprocess/c_preprocessor_conditionals_spec.rb +396 -0
- data/spec/units/preprocess/preprocessinator_code_finder_spec.rb +361 -0
- data/spec/units/preprocess/preprocessinator_comment_stripper_spec.rb +580 -0
- data/spec/units/preprocess/preprocessinator_file_assembler_spec.rb +263 -0
- data/spec/units/preprocess/preprocessinator_includes_handler_spec.rb +337 -0
- data/spec/{preprocessinator_extractor_spec.rb → units/preprocess/preprocessinator_reconstructor_spec.rb} +297 -5
- data/spec/units/reportinator_spec.rb +251 -0
- data/spec/units/ruby_expandinator_spec.rb +91 -0
- data/spec/{system_utils_spec.rb → units/system_utils_spec.rb} +4 -4
- data/spec/units/test_context_extractor_spec.rb +437 -0
- data/spec/{tool_executor_helper_spec.rb → units/tool_executor_helper_spec.rb} +19 -33
- data/spec/units/tool_executor_spec.rb +83 -0
- data/spec/units/tool_validator_spec.rb +60 -0
- data/spec/units/yaml_wrapper_spec.rb +108 -0
- data/vendor/cmock/Gemfile +4 -1
- data/vendor/cmock/LICENSE.txt +1 -1
- data/vendor/cmock/config/production_environment.rb +1 -1
- data/vendor/cmock/config/test_environment.rb +1 -1
- data/vendor/cmock/docs/CMockChangeLog.md +47 -0
- data/vendor/cmock/docs/CMockKnownIssues.md +0 -1
- data/vendor/cmock/docs/CMock_ArgumentValidation.md +180 -25
- data/vendor/cmock/docs/CMock_Summary.md +158 -16
- data/vendor/cmock/examples/make_example/Makefile +1 -1
- data/vendor/cmock/examples/make_example/src/foo.c +1 -1
- data/vendor/cmock/examples/make_example/src/foo.h +1 -1
- data/vendor/cmock/examples/make_example/src/main.c +1 -1
- data/vendor/cmock/examples/make_example/test/test_foo.c +1 -1
- data/vendor/cmock/examples/make_example/test/test_main.c +2 -2
- data/vendor/cmock/examples/temp_sensor/project.yml +75 -0
- data/vendor/cmock/examples/temp_sensor/rakefile.rb +3 -3
- data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +163 -119
- data/vendor/cmock/examples/temp_sensor/src/AT91SAM7X256.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcConductor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcConductor.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcHardware.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcHardware.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcHardwareConfigurator.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcModel.c +3 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcModel.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/AdcTemperatureSensor.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Executor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Executor.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/IntrinsicsWrapper.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Main.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Main.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Model.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Model.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/ModelConfig.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TaskScheduler.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TemperatureCalculator.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.c +2 -2
- data/vendor/cmock/examples/temp_sensor/src/TemperatureFilter.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerConductor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerConductor.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.c +2 -2
- data/vendor/cmock/examples/temp_sensor/src/TimerConfigurator.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerHardware.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerHardware.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.c +10 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptConfigurator.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerInterruptHandler.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerModel.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/TimerModel.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/Types.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartBaudRateRegisterCalculator.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartConductor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartConductor.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartConfigurator.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartHardware.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartHardware.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartModel.c +2 -2
- data/vendor/cmock/examples/temp_sensor/src/UsartModel.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.c +2 -2
- data/vendor/cmock/examples/temp_sensor/src/UsartPutChar.h +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.c +1 -1
- data/vendor/cmock/examples/temp_sensor/src/UsartTransmitBufferStatus.h +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestAdcConductor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestAdcHardware.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestAdcHardwareConfigurator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestAdcModel.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestAdcTemperatureSensor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestExecutor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestMain.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestModel.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTaskScheduler.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTemperatureCalculator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTemperatureFilter.c +2 -2
- data/vendor/cmock/examples/temp_sensor/test/TestTimerConductor.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTimerConfigurator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTimerHardware.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptConfigurator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTimerInterruptHandler.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestTimerModel.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestUsartBaudRateRegisterCalculator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestUsartConductor.c +7 -5
- data/vendor/cmock/examples/temp_sensor/test/TestUsartConfigurator.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestUsartHardware.c +3 -2
- data/vendor/cmock/examples/temp_sensor/test/TestUsartModel.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestUsartPutChar.c +1 -1
- data/vendor/cmock/examples/temp_sensor/test/TestUsartTransmitBufferStatus.c +1 -1
- data/vendor/cmock/lib/cmock.rb +1 -1
- data/vendor/cmock/lib/cmock_config.rb +8 -2
- data/vendor/cmock/lib/cmock_file_writer.rb +38 -1
- data/vendor/cmock/lib/cmock_generator.rb +44 -27
- data/vendor/cmock/lib/cmock_generator_plugin_array.rb +68 -15
- data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +13 -3
- data/vendor/cmock/lib/cmock_generator_plugin_cexception.rb +12 -3
- data/vendor/cmock/lib/cmock_generator_plugin_expect.rb +33 -15
- data/vendor/cmock/lib/cmock_generator_plugin_expect_any_args.rb +13 -8
- data/vendor/cmock/lib/cmock_generator_plugin_ignore.rb +15 -10
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_arg.rb +4 -2
- data/vendor/cmock/lib/cmock_generator_plugin_ignore_stateless.rb +15 -10
- data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +53 -3
- data/vendor/cmock/lib/cmock_generator_utils.rb +159 -43
- data/vendor/cmock/lib/cmock_header_parser.rb +217 -26
- data/vendor/cmock/lib/cmock_plugin_manager.rb +1 -1
- data/vendor/cmock/lib/cmock_unityhelper_parser.rb +7 -2
- data/vendor/cmock/lib/cmock_version.rb +1 -1
- data/vendor/cmock/scripts/create_makefile.rb +7 -5
- data/vendor/cmock/src/cmock.c +132 -129
- data/vendor/cmock/src/cmock.h +7 -13
- data/vendor/cmock/src/cmock_internals.h +73 -39
- data/vendor/cmock/test/c/TestCMockC.c +1 -7
- data/vendor/cmock/test/c/TestCMockC.yml +1 -1
- data/vendor/cmock/test/c/TestCMockCDynamic.c +1 -7
- data/vendor/cmock/test/c/TestCMockCDynamic.yml +1 -1
- data/vendor/cmock/test/c/TestCMockCDynamic_Runner.c +1 -7
- data/vendor/cmock/test/c/TestCMockC_Runner.c +1 -7
- data/vendor/cmock/{vendor/unity/test/targets/gcc_manual_math.yml → test/gcc_64_valgrind.yml} +8 -17
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X-EK.h +1 -1
- data/vendor/cmock/test/iar/iar_v4/incIAR/AT91SAM7X256_inc.h +1 -1
- data/vendor/cmock/test/iar/iar_v4/incIAR/ioat91sam7x256.h +1 -1
- data/vendor/cmock/test/iar/iar_v4/srcIAR/Cstartup_SAM7.c +1 -1
- data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X-EK.h +1 -1
- data/vendor/cmock/test/iar/iar_v5/incIAR/AT91SAM7X256_inc.h +1 -1
- data/vendor/cmock/test/iar/iar_v5/incIAR/project.h +1 -1
- data/vendor/cmock/test/iar/iar_v5/srcIAR/Cstartup_SAM7.c +1 -1
- data/vendor/cmock/test/project.yml +32 -0
- data/vendor/cmock/test/rakefile +74 -58
- data/vendor/cmock/test/rakefile_helper.rb +359 -152
- data/vendor/cmock/test/system/systest_generator.rb +2 -2
- data/vendor/cmock/test/system/test_compilation/callingconv.h +1 -7
- data/vendor/cmock/test/system/test_compilation/config.yml +10 -1
- data/vendor/cmock/test/system/test_compilation/const.h +7 -13
- data/vendor/cmock/test/system/test_compilation/inline.h +1 -2
- data/vendor/cmock/test/system/test_compilation/osek.h +1 -7
- data/vendor/cmock/test/system/test_compilation/parsing.h +37 -7
- data/vendor/cmock/test/system/test_interactions/all_plugins_but_other_limits.yml +5 -13
- data/vendor/cmock/test/system/test_interactions/all_plugins_coexist.yml +5 -5
- data/vendor/cmock/test/system/test_interactions/array_handling.yml +758 -0
- data/vendor/cmock/test/system/test_interactions/basic_expect_and_return.yml +2 -2
- data/vendor/cmock/test/system/test_interactions/char_string_array_plugin.yml +113 -0
- data/vendor/cmock/test/system/test_interactions/const_custom_type.yml +68 -0
- data/vendor/cmock/test/system/test_interactions/const_primitives_handling.yml +4 -3
- data/vendor/cmock/test/system/test_interactions/const_ptr_return_and_arg.yml +89 -0
- data/vendor/cmock/test/system/test_interactions/debug_output.yml +235 -0
- data/vendor/cmock/test/system/test_interactions/doesnt_leave_details_behind.yml +16 -16
- data/vendor/cmock/test/system/test_interactions/enforce_strict_ordering.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/expect_and_return_custom_types.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/expect_and_return_treat_as.yml +3 -3
- data/vendor/cmock/test/system/test_interactions/expect_and_throw.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/expect_any_args.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/fancy_pointer_handling.yml +3 -3
- data/vendor/cmock/test/system/test_interactions/function_pointer_handling.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/ignore_and_return.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/ignore_and_return_stateless.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/ignore_strict_mock_calling.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/newer_standards_stuff1.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_1.yml +2 -2
- data/vendor/cmock/test/system/test_interactions/nonstandard_parsed_stuff_2.yml +7 -4
- data/vendor/cmock/test/system/test_interactions/out_of_memory.yml +65 -8
- data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/parsing_challenges_with_func_pointers.yml +88 -0
- data/vendor/cmock/test/system/test_interactions/pointer_handling.yml +465 -0
- data/vendor/cmock/test/system/test_interactions/{return_thru_ptr_and_expect_any_args.yml → return_thru_ptr_expect_any_args.yml} +9 -13
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore.yml +142 -0
- data/vendor/cmock/test/system/test_interactions/return_thru_ptr_ignore_arg.yml +13 -9
- data/vendor/cmock/test/system/test_interactions/skeleton.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/skeleton_update.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/struct_union_enum_expect_and_return_with_plugins.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/stubs_with_callbacks.yml +14 -2
- data/vendor/cmock/test/system/test_interactions/teardown_mock_calls.yml +57 -0
- data/vendor/cmock/test/system/test_interactions/teardown_mock_expectations.yml +59 -0
- data/vendor/cmock/test/system/test_interactions/unity_64bit_support.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/unity_ignores.yml +1 -1
- data/vendor/cmock/test/system/test_interactions/unity_void_pointer_compare.yml +9 -9
- data/vendor/cmock/test/system/test_interactions/void_pointer_no_array_plugin.yml +133 -0
- data/vendor/cmock/test/system/test_interactions/void_pointer_treat_as_void_array_plugin.yml +102 -0
- data/vendor/cmock/test/system/test_interactions/volatile_pointer_handling.yml +291 -0
- data/vendor/cmock/test/system/test_interactions/wrong_expect_and_return.yml +9 -1
- data/vendor/cmock/test/targets/iar_arm.yml +14 -0
- data/vendor/cmock/test/targets/tiny.yml +36 -0
- data/vendor/cmock/test/test_helper.rb +1 -2
- data/vendor/cmock/test/unit/cmock_config_test.rb +1 -2
- data/vendor/cmock/test/unit/cmock_config_test.yml +1 -1
- data/vendor/cmock/test/unit/cmock_file_writer_test.rb +1 -1
- data/vendor/cmock/test/unit/cmock_generator_main_test.rb +6 -0
- data/vendor/cmock/test/unit/cmock_generator_no_error_stubs_plugin_array_test.rb +90 -0
- data/vendor/cmock/test/unit/cmock_generator_no_error_stubs_plugin_expect_any_args_test.rb +38 -0
- data/vendor/cmock/test/unit/cmock_generator_no_error_stubs_plugin_expect_test.rb +55 -0
- data/vendor/cmock/test/unit/cmock_generator_no_error_stubs_plugin_ignore_stateless_test.rb +42 -0
- data/vendor/cmock/test/unit/cmock_generator_no_error_stubs_plugin_ignore_test.rb +42 -0
- data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +63 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +24 -6
- 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 +118 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +4 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +2 -1
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_stateless_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +2 -2
- data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +135 -3
- data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +177 -9
- data/vendor/cmock/test/unit/cmock_header_parser_test.rb +705 -109
- data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +4 -2
- data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +1 -1
- data/vendor/cmock/vendor/unity/CMakeLists.txt +10 -0
- data/vendor/cmock/vendor/unity/LICENSE.txt +1 -1
- data/vendor/cmock/vendor/unity/README.md +2 -2
- data/vendor/cmock/vendor/unity/auto/__init__.py +1 -1
- data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +1 -1
- data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +7 -1
- data/vendor/cmock/vendor/unity/auto/extract_version.py +1 -1
- data/vendor/cmock/vendor/unity/auto/generate_config.yml +1 -1
- data/vendor/cmock/vendor/unity/auto/generate_module.rb +6 -6
- data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +95 -14
- data/vendor/cmock/vendor/unity/auto/parse_output.rb +10 -7
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.py +4 -3
- data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +4 -2
- data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +1 -1
- data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +1 -1
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +2 -2
- data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +5 -2
- data/vendor/cmock/vendor/unity/auto/yaml_helper.rb +1 -1
- data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +2 -2
- data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +66 -1
- data/vendor/cmock/vendor/unity/docs/UnityChangeLog.md +41 -0
- data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +2 -2
- data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +28 -12
- data/vendor/cmock/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/src/ProductionCode2.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_1/test/TestProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/makefile +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/src/ProductionCode2.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/test/TestProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_2/test/test_runners/all_tests.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/helper/UnityHelper.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/project.yml +24 -0
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +2 -3
- data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +107 -153
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.c +3 -3
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/src/ProductionCode2.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_3/test/TestProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_4/src/ProductionCode2.h +1 -1
- data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_4/test/TestProductionCode2.c +1 -1
- data/vendor/cmock/vendor/unity/examples/example_5/makefile +63 -0
- data/vendor/cmock/vendor/unity/examples/example_5/readme.txt +38 -0
- data/vendor/cmock/vendor/unity/examples/example_5/src/ProductionCode.c +56 -0
- data/vendor/cmock/vendor/unity/examples/example_5/src/ProductionCode.h +16 -0
- data/vendor/cmock/vendor/unity/examples/example_5/subprojects/unity.wrap +3 -0
- data/vendor/cmock/vendor/unity/examples/example_5/test/TestProductionCode.c +45 -0
- data/vendor/cmock/vendor/unity/examples/example_5/test/test_runners/TestProductionCode_Runner.c +48 -0
- data/vendor/cmock/vendor/unity/examples/example_5/test/unity_detail_config.h +25 -0
- data/vendor/cmock/vendor/unity/examples/unity_config.h +5 -3
- data/vendor/cmock/vendor/unity/extras/bdd/src/unity_bdd.h +1 -1
- data/vendor/cmock/vendor/unity/extras/bdd/test/test_bdd.c +1 -1
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +59 -15
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +4 -1
- data/vendor/cmock/vendor/unity/extras/fixture/test/main/AllTests.c +1 -1
- data/vendor/cmock/vendor/unity/extras/fixture/test/template_fixture_tests.c +1 -1
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +46 -1
- data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +4 -1
- data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.c +1 -1
- data/vendor/cmock/vendor/unity/extras/memory/src/unity_memory.h +1 -1
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_Test.c +1 -1
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +1 -1
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.c +1 -1
- data/vendor/cmock/vendor/unity/extras/memory/test/unity_output_Spy.h +1 -1
- data/vendor/cmock/vendor/unity/library.json +0 -7
- data/vendor/cmock/vendor/unity/meson.build +16 -8
- data/vendor/cmock/vendor/unity/meson_options.txt +5 -3
- data/vendor/cmock/vendor/unity/src/unity.c +480 -141
- data/vendor/cmock/vendor/unity/src/unity.h +16 -4
- data/vendor/cmock/vendor/unity/src/unity_internals.h +291 -148
- data/vendor/cmock/vendor/unity/test/Makefile +4 -6
- data/vendor/cmock/vendor/unity/test/rakefile +42 -21
- data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +154 -15
- data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +1 -1
- data/vendor/cmock/vendor/unity/test/targets/clang.yml +157 -0
- data/vendor/cmock/vendor/unity/test/targets/gcc.yml +139 -0
- data/vendor/cmock/vendor/unity/test/targets/hitech_picc18.yml +9 -16
- data/vendor/cmock/vendor/unity/test/targets/iar_arm.yml +88 -0
- data/vendor/cmock/vendor/unity/test/targets/no_stdlib.yml +23 -0
- data/vendor/cmock/vendor/unity/test/testdata/CException.h +1 -1
- data/vendor/cmock/vendor/unity/test/testdata/Defs.h +1 -1
- data/vendor/cmock/vendor/unity/test/testdata/cmock.h +1 -1
- data/vendor/cmock/vendor/unity/test/testdata/mockMock.h +1 -1
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGenerator.c +1 -1
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +1 -1
- data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +1 -1
- data/vendor/cmock/vendor/unity/test/tests/self_assessment_utils.h +23 -7
- data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +1 -4
- data/vendor/cmock/vendor/unity/test/tests/test_unity_arrays.c +1 -1
- data/vendor/cmock/vendor/unity/test/tests/test_unity_core.c +33 -38
- data/vendor/cmock/vendor/unity/test/tests/test_unity_doubles.c +4 -4
- data/vendor/cmock/vendor/unity/test/tests/test_unity_floats.c +15 -6
- data/vendor/cmock/vendor/unity/test/tests/test_unity_integers.c +35 -1
- data/vendor/cmock/vendor/unity/test/tests/test_unity_integers_64.c +1 -1
- data/vendor/cmock/vendor/unity/test/tests/test_unity_memory.c +69 -1
- data/vendor/cmock/vendor/unity/test/tests/test_unity_parameterized.c +5 -5
- data/vendor/cmock/vendor/unity/test/tests/test_unity_parameterizedDemo.c +1 -1
- data/vendor/cmock/vendor/unity/test/tests/test_unity_strings.c +65 -1
- data/vendor/cmock/vendor/unity/test/tests/types_for_test.h +1 -1
- data/vendor/unity/CMakeLists.txt +10 -0
- data/vendor/unity/LICENSE.txt +1 -1
- data/vendor/unity/README.md +2 -2
- data/vendor/unity/auto/__init__.py +1 -1
- data/vendor/unity/auto/colour_prompt.rb +1 -1
- data/vendor/unity/auto/colour_reporter.rb +7 -1
- data/vendor/unity/auto/extract_version.py +1 -1
- data/vendor/unity/auto/generate_config.yml +1 -1
- data/vendor/unity/auto/generate_module.rb +6 -6
- data/vendor/unity/auto/generate_test_runner.rb +95 -14
- data/vendor/unity/auto/parse_output.rb +10 -7
- data/vendor/unity/auto/stylize_as_junit.py +4 -3
- data/vendor/unity/auto/stylize_as_junit.rb +4 -2
- data/vendor/unity/auto/test_file_filter.rb +1 -1
- data/vendor/unity/auto/type_sanitizer.rb +1 -1
- data/vendor/unity/auto/unity_test_summary.py +2 -2
- data/vendor/unity/auto/unity_test_summary.rb +5 -2
- data/vendor/unity/auto/yaml_helper.rb +1 -1
- data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +2 -2
- data/vendor/unity/docs/UnityAssertionsReference.md +66 -1
- data/vendor/unity/docs/UnityChangeLog.md +41 -0
- data/vendor/unity/docs/UnityConfigurationGuide.md +2 -2
- data/vendor/unity/docs/UnityHelperScriptsGuide.md +28 -12
- data/vendor/unity/examples/example_1/makefile +1 -1
- data/vendor/unity/examples/example_1/src/ProductionCode.c +1 -1
- data/vendor/unity/examples/example_1/src/ProductionCode.h +1 -1
- data/vendor/unity/examples/example_1/src/ProductionCode2.c +1 -1
- data/vendor/unity/examples/example_1/src/ProductionCode2.h +1 -1
- data/vendor/unity/examples/example_1/test/TestProductionCode.c +1 -1
- data/vendor/unity/examples/example_1/test/TestProductionCode2.c +1 -1
- data/vendor/unity/examples/example_2/makefile +1 -1
- data/vendor/unity/examples/example_2/src/ProductionCode.c +1 -1
- data/vendor/unity/examples/example_2/src/ProductionCode.h +1 -1
- data/vendor/unity/examples/example_2/src/ProductionCode2.c +1 -1
- data/vendor/unity/examples/example_2/src/ProductionCode2.h +1 -1
- data/vendor/unity/examples/example_2/test/TestProductionCode.c +1 -1
- data/vendor/unity/examples/example_2/test/TestProductionCode2.c +1 -1
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode2_Runner.c +1 -1
- data/vendor/unity/examples/example_2/test/test_runners/TestProductionCode_Runner.c +1 -1
- data/vendor/unity/examples/example_2/test/test_runners/all_tests.c +1 -1
- data/vendor/unity/examples/example_3/helper/UnityHelper.c +1 -1
- data/vendor/unity/examples/example_3/helper/UnityHelper.h +1 -1
- data/vendor/unity/examples/example_3/project.yml +24 -0
- data/vendor/unity/examples/example_3/rakefile.rb +2 -3
- data/vendor/unity/examples/example_3/rakefile_helper.rb +107 -153
- data/vendor/unity/examples/example_3/src/ProductionCode.c +3 -3
- data/vendor/unity/examples/example_3/src/ProductionCode.h +1 -1
- data/vendor/unity/examples/example_3/src/ProductionCode2.c +1 -1
- data/vendor/unity/examples/example_3/src/ProductionCode2.h +1 -1
- data/vendor/unity/examples/example_3/test/TestProductionCode.c +1 -1
- data/vendor/unity/examples/example_3/test/TestProductionCode2.c +1 -1
- data/vendor/unity/examples/example_4/src/ProductionCode.c +1 -1
- data/vendor/unity/examples/example_4/src/ProductionCode.h +1 -1
- data/vendor/unity/examples/example_4/src/ProductionCode2.c +1 -1
- data/vendor/unity/examples/example_4/src/ProductionCode2.h +1 -1
- data/vendor/unity/examples/example_4/test/TestProductionCode.c +1 -1
- data/vendor/unity/examples/example_4/test/TestProductionCode2.c +1 -1
- data/vendor/unity/examples/example_5/makefile +63 -0
- data/vendor/unity/examples/example_5/readme.txt +38 -0
- data/vendor/unity/examples/example_5/src/ProductionCode.c +56 -0
- data/vendor/unity/examples/example_5/src/ProductionCode.h +16 -0
- data/vendor/unity/examples/example_5/subprojects/unity.wrap +3 -0
- data/vendor/unity/examples/example_5/test/TestProductionCode.c +45 -0
- data/vendor/unity/examples/example_5/test/test_runners/TestProductionCode_Runner.c +48 -0
- data/vendor/unity/examples/example_5/test/unity_detail_config.h +25 -0
- data/vendor/unity/examples/unity_config.h +5 -3
- data/vendor/unity/extras/bdd/src/unity_bdd.h +1 -1
- data/vendor/unity/extras/bdd/test/test_bdd.c +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture.c +59 -15
- data/vendor/unity/extras/fixture/src/unity_fixture.h +1 -1
- data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +4 -1
- data/vendor/unity/extras/fixture/test/main/AllTests.c +1 -1
- data/vendor/unity/extras/fixture/test/template_fixture_tests.c +1 -1
- data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +46 -1
- data/vendor/unity/extras/fixture/test/unity_fixture_TestRunner.c +4 -1
- data/vendor/unity/extras/memory/src/unity_memory.c +1 -1
- data/vendor/unity/extras/memory/src/unity_memory.h +1 -1
- data/vendor/unity/extras/memory/test/unity_memory_Test.c +1 -1
- data/vendor/unity/extras/memory/test/unity_memory_TestRunner.c +1 -1
- data/vendor/unity/extras/memory/test/unity_output_Spy.c +1 -1
- data/vendor/unity/extras/memory/test/unity_output_Spy.h +1 -1
- data/vendor/unity/library.json +0 -7
- data/vendor/unity/meson.build +16 -8
- data/vendor/unity/meson_options.txt +5 -3
- data/vendor/unity/src/unity.c +480 -141
- data/vendor/unity/src/unity.h +16 -4
- data/vendor/unity/src/unity_internals.h +291 -148
- data/vendor/unity/test/Makefile +4 -6
- data/vendor/unity/test/rakefile +42 -21
- data/vendor/unity/test/rakefile_helper.rb +154 -15
- data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +1 -1
- data/vendor/unity/test/targets/clang.yml +157 -0
- data/vendor/unity/test/targets/gcc.yml +139 -0
- data/vendor/unity/test/targets/hitech_picc18.yml +9 -16
- data/vendor/unity/test/targets/iar_arm.yml +88 -0
- data/vendor/unity/test/targets/no_stdlib.yml +23 -0
- data/vendor/unity/test/testdata/CException.h +1 -1
- data/vendor/unity/test/testdata/Defs.h +1 -1
- data/vendor/unity/test/testdata/cmock.h +1 -1
- data/vendor/unity/test/testdata/mockMock.h +1 -1
- data/vendor/unity/test/testdata/testRunnerGenerator.c +1 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +1 -1
- data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +1 -1
- data/vendor/unity/test/tests/self_assessment_utils.h +23 -7
- data/vendor/unity/test/tests/test_generate_test_runner.rb +1 -4
- data/vendor/unity/test/tests/test_unity_arrays.c +1 -1
- data/vendor/unity/test/tests/test_unity_core.c +33 -38
- data/vendor/unity/test/tests/test_unity_doubles.c +4 -4
- data/vendor/unity/test/tests/test_unity_floats.c +15 -6
- data/vendor/unity/test/tests/test_unity_integers.c +35 -1
- data/vendor/unity/test/tests/test_unity_integers_64.c +1 -1
- data/vendor/unity/test/tests/test_unity_memory.c +69 -1
- data/vendor/unity/test/tests/test_unity_parameterized.c +5 -5
- data/vendor/unity/test/tests/test_unity_parameterizedDemo.c +1 -1
- data/vendor/unity/test/tests/test_unity_strings.c +65 -1
- data/vendor/unity/test/tests/types_for_test.h +1 -1
- metadata +702 -177
- data/docs/CeedlingPacket.md +0 -5651
- data/lib/ceedling/build_batchinator.rb +0 -113
- data/lib/ceedling/generator_test_results_backtrace.rb +0 -215
- data/lib/ceedling/generator_test_runner.rb +0 -84
- data/lib/ceedling/preprocessinator.rb +0 -239
- data/lib/ceedling/preprocessinator_extractor.rb +0 -257
- data/lib/ceedling/preprocessinator_file_handler.rb +0 -229
- data/lib/ceedling/preprocessinator_includes_handler.rb +0 -382
- data/lib/ceedling/task_invoker.rb +0 -70
- data/lib/ceedling/test_invoker.rb +0 -506
- data/lib/ceedling/test_invoker_helper.rb +0 -347
- data/plugins/gcov/README.md +0 -893
- data/plugins/gcov/lib/reportinator_helper.rb +0 -30
- data/plugins/report_tests_log_factory/sample_html_report.png +0 -0
- data/spec/configurator_spec.rb +0 -18
- data/spec/generator_test_results_spec.rb +0 -131
- data/spec/parsing_parcels_spec.rb +0 -66
- data/spec/preprocessinator_includes_handler_spec.rb +0 -289
- data/spec/reportinator_spec.rb +0 -26
- data/spec/spec_helper.rb +0 -31
- data/spec/test_context_extractor_spec.rb +0 -328
- data/spec/uncategorized_specs_spec.rb +0 -15
- data/vendor/cmock/examples/temp_sensor/targets/gcc.yml +0 -97
- data/vendor/cmock/examples/temp_sensor/targets/iar_v4.yml +0 -143
- data/vendor/cmock/examples/temp_sensor/targets/iar_v5.yml +0 -132
- data/vendor/cmock/scripts/create_mock.rb +0 -15
- data/vendor/cmock/scripts/create_runner.rb +0 -25
- data/vendor/cmock/scripts/test_summary.rb +0 -25
- data/vendor/cmock/test/system/test_interactions/array_and_pointer_handling.yml +0 -453
- data/vendor/cmock/test/targets/clang_strict.yml +0 -97
- data/vendor/cmock/test/targets/gcc.yml +0 -65
- data/vendor/cmock/test/targets/gcc_64.yml +0 -65
- data/vendor/cmock/test/targets/gcc_tiny.yml +0 -87
- data/vendor/cmock/test/targets/iar_arm_v4.yml +0 -117
- data/vendor/cmock/test/targets/iar_arm_v5.yml +0 -102
- data/vendor/cmock/vendor/unity/examples/example_3/target_gcc_32.yml +0 -54
- data/vendor/cmock/vendor/unity/test/targets/ansi.yml +0 -51
- data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +0 -79
- data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +0 -79
- data/vendor/cmock/vendor/unity/test/targets/gcc_32.yml +0 -52
- data/vendor/cmock/vendor/unity/test/targets/gcc_64.yml +0 -53
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_limits.yml +0 -50
- data/vendor/cmock/vendor/unity/test/targets/gcc_auto_stdint.yml +0 -62
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v4.yml +0 -105
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5.yml +0 -99
- data/vendor/cmock/vendor/unity/test/targets/iar_arm_v5_3.yml +0 -99
- data/vendor/cmock/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -97
- data/vendor/cmock/vendor/unity/test/targets/iar_cortexm3_v5.yml +0 -101
- data/vendor/cmock/vendor/unity/test/targets/iar_msp430.yml +0 -119
- data/vendor/cmock/vendor/unity/test/targets/iar_sh2a_v6.yml +0 -106
- data/vendor/unity/examples/example_3/target_gcc_32.yml +0 -54
- data/vendor/unity/test/targets/ansi.yml +0 -51
- data/vendor/unity/test/targets/clang_file.yml +0 -79
- data/vendor/unity/test/targets/clang_strict.yml +0 -79
- data/vendor/unity/test/targets/gcc_32.yml +0 -52
- data/vendor/unity/test/targets/gcc_64.yml +0 -53
- data/vendor/unity/test/targets/gcc_auto_limits.yml +0 -50
- data/vendor/unity/test/targets/gcc_auto_stdint.yml +0 -62
- data/vendor/unity/test/targets/gcc_manual_math.yml +0 -50
- data/vendor/unity/test/targets/iar_arm_v4.yml +0 -105
- data/vendor/unity/test/targets/iar_arm_v5.yml +0 -99
- data/vendor/unity/test/targets/iar_arm_v5_3.yml +0 -99
- data/vendor/unity/test/targets/iar_armcortex_LM3S9B92_v5_4.yml +0 -97
- data/vendor/unity/test/targets/iar_cortexm3_v5.yml +0 -101
- data/vendor/unity/test/targets/iar_msp430.yml +0 -119
- data/vendor/unity/test/targets/iar_sh2a_v6.yml +0 -106
|
@@ -0,0 +1,2742 @@
|
|
|
1
|
+
# =========================================================================
|
|
2
|
+
# Ceedling - Test-Centered Build System for C
|
|
3
|
+
# ThrowTheSwitch.org
|
|
4
|
+
# Copyright (c) 2010-26 Mike Karlesky, Mark VanderVoord, & Greg Williams
|
|
5
|
+
# SPDX-License-Identifier: MIT
|
|
6
|
+
# =========================================================================
|
|
7
|
+
|
|
8
|
+
require 'spec_helper'
|
|
9
|
+
require 'ceedling/c_extractor/c_extractor_code_text'
|
|
10
|
+
require 'ceedling/c_extractor/c_extractor_functions'
|
|
11
|
+
require 'ceedling/c_extractor/c_extractor_types'
|
|
12
|
+
require 'stringio'
|
|
13
|
+
|
|
14
|
+
describe CExtractorFunctions do
|
|
15
|
+
|
|
16
|
+
###
|
|
17
|
+
### extract_function_signature()
|
|
18
|
+
###
|
|
19
|
+
|
|
20
|
+
describe "#extract_function_signature (private method testing)" do
|
|
21
|
+
# Helper to access private method
|
|
22
|
+
let(:extract_signature) do
|
|
23
|
+
->(content, type, max_line_length=1000) do
|
|
24
|
+
scanner = StringScanner.new(content)
|
|
25
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
26
|
+
functions.setup()
|
|
27
|
+
functions.max_line_length = max_line_length
|
|
28
|
+
signature = functions.send( :extract_function_signature, scanner, type )
|
|
29
|
+
return [signature, scanner.pos, scanner.rest]
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
context "simple signatures from function definitions" do
|
|
34
|
+
it "extracts void function signature with void parameters" do
|
|
35
|
+
content = "void foo(void){"
|
|
36
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
37
|
+
|
|
38
|
+
expect(signature).to eq("void foo(void)")
|
|
39
|
+
expect(pos).to eq(14)
|
|
40
|
+
expect(rest).to eq("{")
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
it "extracts void function signature with no parameters" do
|
|
44
|
+
content = "void foo(){"
|
|
45
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
46
|
+
|
|
47
|
+
expect(signature).to eq("void foo()")
|
|
48
|
+
expect(pos).to eq(10)
|
|
49
|
+
expect(rest).to eq("{")
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
it "extracts void function signature with no parameters and brace after newline" do
|
|
53
|
+
content = "void foo()\n{"
|
|
54
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
55
|
+
|
|
56
|
+
expect(signature).to eq("void foo()")
|
|
57
|
+
expect(pos).to eq(11)
|
|
58
|
+
expect(rest).to eq("{")
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
it "extracts int function signature with no parameters and whitespace between signature and function body brace" do
|
|
62
|
+
content = "int bar(void) {"
|
|
63
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
64
|
+
|
|
65
|
+
expect(signature).to eq("int bar(void)")
|
|
66
|
+
expect(pos).to eq(17)
|
|
67
|
+
expect(rest).to eq("{")
|
|
68
|
+
end
|
|
69
|
+
|
|
70
|
+
it "extracts signature followed by line comment" do
|
|
71
|
+
content = "void foo(void) // comment\n{"
|
|
72
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
73
|
+
|
|
74
|
+
expect(signature).to eq("void foo(void)")
|
|
75
|
+
expect(pos).to eq(26)
|
|
76
|
+
expect(rest).to eq("{")
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
it "extracts function signature with single parameter and comment between signature and function body brace" do
|
|
80
|
+
content = "int add(int x)/* */{ int a;"
|
|
81
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
82
|
+
|
|
83
|
+
expect(signature).to eq("int add(int x)")
|
|
84
|
+
expect(pos).to eq(19)
|
|
85
|
+
expect(rest).to eq("{ int a;")
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it "extracts function signature with multiple parameters" do
|
|
89
|
+
content = "int multiply(int a, int b){"
|
|
90
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
91
|
+
|
|
92
|
+
expect(signature).to eq("int multiply(int a, int b)")
|
|
93
|
+
expect(pos).to eq(26)
|
|
94
|
+
expect(rest).to eq("{")
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it "extracts function signature returning pointer" do
|
|
98
|
+
content = "char* getString(void){"
|
|
99
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
100
|
+
|
|
101
|
+
expect(signature).to eq("char* getString(void)")
|
|
102
|
+
expect(pos).to eq(21)
|
|
103
|
+
expect(rest).to eq("{")
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
it "extracts function signature with pointer parameter" do
|
|
107
|
+
content = "void process(int* ptr){"
|
|
108
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
109
|
+
|
|
110
|
+
expect(signature).to eq("void process(int* ptr)")
|
|
111
|
+
expect(pos).to eq(22)
|
|
112
|
+
expect(rest).to eq("{")
|
|
113
|
+
end
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
context "function declarations" do
|
|
117
|
+
it "does not extract signature from declaration" do
|
|
118
|
+
content = "void process(int* ptr);"
|
|
119
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
120
|
+
|
|
121
|
+
expect(signature).to be_nil
|
|
122
|
+
expect(pos).to eq(0)
|
|
123
|
+
expect(rest).to eq("void process(int* ptr);")
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
it "does not extract signature from declaration with whitespace" do
|
|
127
|
+
content = "void process(int* ptr) ;"
|
|
128
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
129
|
+
|
|
130
|
+
expect(signature).to be_nil
|
|
131
|
+
expect(pos).to eq(0)
|
|
132
|
+
expect(rest).to eq("void process(int* ptr) ;")
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
it "does not extract signature from declaration with comment" do
|
|
136
|
+
content = "void process(int* ptr)/***/;"
|
|
137
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
138
|
+
|
|
139
|
+
expect(signature).to be_nil
|
|
140
|
+
expect(pos).to eq(0)
|
|
141
|
+
expect(rest).to eq("void process(int* ptr)/***/;")
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
it "does not extract signature from declaration with newline" do
|
|
145
|
+
content = "void process(int* ptr)\n;"
|
|
146
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
147
|
+
|
|
148
|
+
expect(signature).to be_nil
|
|
149
|
+
expect(pos).to eq(0)
|
|
150
|
+
expect(rest).to eq("void process(int* ptr)\n;")
|
|
151
|
+
end
|
|
152
|
+
|
|
153
|
+
it "does extract declaration" do
|
|
154
|
+
content = "void process(int* ptr);"
|
|
155
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
156
|
+
|
|
157
|
+
expect(signature).to eq("void process(int* ptr);")
|
|
158
|
+
expect(pos).to eq(23)
|
|
159
|
+
expect(rest).to eq("")
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it "does extract declaration with whitespace" do
|
|
163
|
+
content = "void process(int* ptr) ;"
|
|
164
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
165
|
+
|
|
166
|
+
expect(signature).to eq("void process(int* ptr);")
|
|
167
|
+
expect(pos).to eq(28)
|
|
168
|
+
expect(rest).to eq("")
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
it "does extract declaration with comment" do
|
|
172
|
+
content = "void process(int* ptr)/***/;"
|
|
173
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
174
|
+
|
|
175
|
+
expect(signature).to eq("void process(int* ptr);")
|
|
176
|
+
expect(pos).to eq(28)
|
|
177
|
+
expect(rest).to eq("")
|
|
178
|
+
end
|
|
179
|
+
|
|
180
|
+
it "does extract declaration with newline" do
|
|
181
|
+
content = "void process(int* ptr)\n;"
|
|
182
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
183
|
+
|
|
184
|
+
expect(signature).to eq("void process(int* ptr);")
|
|
185
|
+
expect(pos).to eq(24)
|
|
186
|
+
expect(rest).to eq("")
|
|
187
|
+
end
|
|
188
|
+
end
|
|
189
|
+
|
|
190
|
+
context "rejecting variable declarations when extracting function declarations" do
|
|
191
|
+
it "rejects simple variable declaration" do
|
|
192
|
+
content = "int x;"
|
|
193
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
194
|
+
|
|
195
|
+
expect(signature).to be_nil
|
|
196
|
+
expect(pos).to eq(0)
|
|
197
|
+
expect(rest).to eq("int x;")
|
|
198
|
+
end
|
|
199
|
+
|
|
200
|
+
it "rejects pointer variable declaration" do
|
|
201
|
+
content = "int* ptr;"
|
|
202
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
203
|
+
|
|
204
|
+
expect(signature).to be_nil
|
|
205
|
+
expect(pos).to eq(0)
|
|
206
|
+
expect(rest).to eq("int* ptr;")
|
|
207
|
+
end
|
|
208
|
+
|
|
209
|
+
it "rejects array variable declaration" do
|
|
210
|
+
content = "int arr[10];"
|
|
211
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
212
|
+
|
|
213
|
+
expect(signature).to be_nil
|
|
214
|
+
expect(pos).to eq(0)
|
|
215
|
+
expect(rest).to eq("int arr[10];")
|
|
216
|
+
end
|
|
217
|
+
|
|
218
|
+
it "rejects function pointer variable declaration" do
|
|
219
|
+
content = "int (*func_ptr)(int, int);"
|
|
220
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
221
|
+
|
|
222
|
+
expect(signature).to be_nil
|
|
223
|
+
expect(pos).to eq(0)
|
|
224
|
+
expect(rest).to eq("int (*func_ptr)(int, int);")
|
|
225
|
+
end
|
|
226
|
+
|
|
227
|
+
it "rejects const variable declaration" do
|
|
228
|
+
content = "const int MAX_VALUE;"
|
|
229
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
230
|
+
|
|
231
|
+
expect(signature).to be_nil
|
|
232
|
+
expect(pos).to eq(0)
|
|
233
|
+
expect(rest).to eq("const int MAX_VALUE;")
|
|
234
|
+
end
|
|
235
|
+
|
|
236
|
+
it "rejects static variable declaration" do
|
|
237
|
+
content = "static int counter;"
|
|
238
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
239
|
+
|
|
240
|
+
expect(signature).to be_nil
|
|
241
|
+
expect(pos).to eq(0)
|
|
242
|
+
expect(rest).to eq("static int counter;")
|
|
243
|
+
end
|
|
244
|
+
|
|
245
|
+
it "rejects struct variable declaration" do
|
|
246
|
+
content = "struct point p;"
|
|
247
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
248
|
+
|
|
249
|
+
expect(signature).to be_nil
|
|
250
|
+
expect(pos).to eq(0)
|
|
251
|
+
expect(rest).to eq("struct point p;")
|
|
252
|
+
end
|
|
253
|
+
|
|
254
|
+
it "rejects variable with initializer" do
|
|
255
|
+
content = "int value = 42;"
|
|
256
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
257
|
+
|
|
258
|
+
expect(signature).to be_nil
|
|
259
|
+
expect(pos).to eq(0)
|
|
260
|
+
expect(rest).to eq("int value = 42;")
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
it "rejects array with initializer" do
|
|
264
|
+
content = "int arr[] = {1, 2, 3};"
|
|
265
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
266
|
+
|
|
267
|
+
expect(signature).to be_nil
|
|
268
|
+
expect(pos).to eq(0)
|
|
269
|
+
expect(rest).to eq("int arr[] = {1, 2, 3};")
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
it "rejects string variable declaration" do
|
|
273
|
+
content = 'char str[] = "hello";'
|
|
274
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
275
|
+
|
|
276
|
+
expect(signature).to be_nil
|
|
277
|
+
expect(pos).to eq(0)
|
|
278
|
+
expect(rest).to eq('char str[] = "hello";')
|
|
279
|
+
end
|
|
280
|
+
|
|
281
|
+
it "rejects extern variable declaration" do
|
|
282
|
+
content = "extern int global_var;"
|
|
283
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
284
|
+
|
|
285
|
+
expect(signature).to be_nil
|
|
286
|
+
expect(pos).to eq(0)
|
|
287
|
+
expect(rest).to eq("extern int global_var;")
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
it "rejects volatile variable declaration" do
|
|
291
|
+
content = "volatile int flag;"
|
|
292
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
293
|
+
|
|
294
|
+
expect(signature).to be_nil
|
|
295
|
+
expect(pos).to eq(0)
|
|
296
|
+
expect(rest).to eq("volatile int flag;")
|
|
297
|
+
end
|
|
298
|
+
|
|
299
|
+
it "rejects typedef'd type variable declaration" do
|
|
300
|
+
content = "size_t length;"
|
|
301
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
302
|
+
|
|
303
|
+
expect(signature).to be_nil
|
|
304
|
+
expect(pos).to eq(0)
|
|
305
|
+
expect(rest).to eq("size_t length;")
|
|
306
|
+
end
|
|
307
|
+
|
|
308
|
+
it "rejects multi-dimensional array declaration" do
|
|
309
|
+
content = "int matrix[3][4];"
|
|
310
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
311
|
+
|
|
312
|
+
expect(signature).to be_nil
|
|
313
|
+
expect(pos).to eq(0)
|
|
314
|
+
expect(rest).to eq("int matrix[3][4];")
|
|
315
|
+
end
|
|
316
|
+
|
|
317
|
+
it "rejects pointer to array declaration" do
|
|
318
|
+
content = "int (*ptr)[10];"
|
|
319
|
+
signature, pos, rest = extract_signature.call(content, :declaration)
|
|
320
|
+
|
|
321
|
+
expect(signature).to be_nil
|
|
322
|
+
expect(pos).to eq(0)
|
|
323
|
+
expect(rest).to eq("int (*ptr)[10];")
|
|
324
|
+
end
|
|
325
|
+
end
|
|
326
|
+
|
|
327
|
+
context "function signatures with whitespace variations" do
|
|
328
|
+
it "extracts signature with extra spaces" do
|
|
329
|
+
content = "int foo ( int x ){"
|
|
330
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
331
|
+
|
|
332
|
+
expect(signature).to eq("int foo ( int x )")
|
|
333
|
+
expect(pos).to eq(26)
|
|
334
|
+
expect(rest).to eq("{")
|
|
335
|
+
end
|
|
336
|
+
|
|
337
|
+
it "extracts clean signature from one with tabs" do
|
|
338
|
+
content = "int\tfoo\t(\tint\tx\t){"
|
|
339
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
340
|
+
|
|
341
|
+
expect(signature).to eq("int foo ( int x )")
|
|
342
|
+
expect(pos).to eq(17)
|
|
343
|
+
expect(rest).to eq("{")
|
|
344
|
+
end
|
|
345
|
+
|
|
346
|
+
it "extracts clean signature from one with newlines" do
|
|
347
|
+
content = "int\nfoo\n(\nint x\n){"
|
|
348
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
349
|
+
|
|
350
|
+
expect(signature).to eq("int foo ( int x )")
|
|
351
|
+
expect(pos).to eq(17)
|
|
352
|
+
expect(rest).to eq("{")
|
|
353
|
+
end
|
|
354
|
+
|
|
355
|
+
it "extracts clean signature from one with mixed whitespace" do
|
|
356
|
+
content = "int \t\n foo \t\n ( \t\n int x \t\n ){"
|
|
357
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
358
|
+
|
|
359
|
+
expect(signature).to eq("int foo ( int x )")
|
|
360
|
+
expect(pos).to eq(29)
|
|
361
|
+
expect(rest).to eq("{")
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
|
|
365
|
+
context "complex return types" do
|
|
366
|
+
it "extracts function returning struct" do
|
|
367
|
+
content = "struct point getPoint(void){"
|
|
368
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
369
|
+
|
|
370
|
+
expect(signature).to eq("struct point getPoint(void)")
|
|
371
|
+
expect(pos).to eq(27)
|
|
372
|
+
expect(rest).to eq("{")
|
|
373
|
+
end
|
|
374
|
+
|
|
375
|
+
it "extracts function returning pointer to struct" do
|
|
376
|
+
content = "struct node* getNode(void){"
|
|
377
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
378
|
+
|
|
379
|
+
expect(signature).to eq("struct node* getNode(void)")
|
|
380
|
+
expect(pos).to eq(26)
|
|
381
|
+
expect(rest).to eq("{")
|
|
382
|
+
end
|
|
383
|
+
|
|
384
|
+
it "extracts function returning const pointer" do
|
|
385
|
+
content = "const char* getMessage(void){"
|
|
386
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
387
|
+
|
|
388
|
+
expect(signature).to eq("const char* getMessage(void)")
|
|
389
|
+
expect(pos).to eq(28)
|
|
390
|
+
expect(rest).to eq("{")
|
|
391
|
+
end
|
|
392
|
+
|
|
393
|
+
it "extracts function returning pointer to const" do
|
|
394
|
+
content = "char* const getBuffer(void){"
|
|
395
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
396
|
+
|
|
397
|
+
expect(signature).to eq("char* const getBuffer(void)")
|
|
398
|
+
expect(pos).to eq(27)
|
|
399
|
+
expect(rest).to eq("{")
|
|
400
|
+
end
|
|
401
|
+
|
|
402
|
+
it "extracts function returning unsigned type" do
|
|
403
|
+
content = "unsigned int getValue(void){"
|
|
404
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
405
|
+
|
|
406
|
+
expect(signature).to eq("unsigned int getValue(void)")
|
|
407
|
+
expect(pos).to eq(27)
|
|
408
|
+
expect(rest).to eq("{")
|
|
409
|
+
end
|
|
410
|
+
|
|
411
|
+
it "extracts function returning long long" do
|
|
412
|
+
content = "long long getBigValue(void){"
|
|
413
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
414
|
+
|
|
415
|
+
expect(signature).to eq("long long getBigValue(void)")
|
|
416
|
+
expect(pos).to eq(27)
|
|
417
|
+
expect(rest).to eq("{")
|
|
418
|
+
end
|
|
419
|
+
|
|
420
|
+
it "extracts function returning enum" do
|
|
421
|
+
content = "enum status getStatus(void){"
|
|
422
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
423
|
+
|
|
424
|
+
expect(signature).to eq("enum status getStatus(void)")
|
|
425
|
+
expect(pos).to eq(27)
|
|
426
|
+
expect(rest).to eq("{")
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
it "extracts function returning typedef'd type" do
|
|
430
|
+
content = "size_t getSize(void){"
|
|
431
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
432
|
+
|
|
433
|
+
expect(signature).to eq("size_t getSize(void)")
|
|
434
|
+
expect(pos).to eq(20)
|
|
435
|
+
expect(rest).to eq("{")
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
it "extracts function returning double pointer" do
|
|
439
|
+
content = "char** getStringArray(void){"
|
|
440
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
441
|
+
|
|
442
|
+
expect(signature).to eq("char** getStringArray(void)")
|
|
443
|
+
expect(pos).to eq(27)
|
|
444
|
+
expect(rest).to eq("{")
|
|
445
|
+
end
|
|
446
|
+
end
|
|
447
|
+
|
|
448
|
+
context "complex parameter types" do
|
|
449
|
+
it "extracts function with array parameter" do
|
|
450
|
+
content = "void process(int arr[]){"
|
|
451
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
452
|
+
|
|
453
|
+
expect(signature).to eq("void process(int arr[])")
|
|
454
|
+
expect(pos).to eq(23)
|
|
455
|
+
expect(rest).to eq("{")
|
|
456
|
+
end
|
|
457
|
+
|
|
458
|
+
it "extracts function with sized array parameter" do
|
|
459
|
+
content = "void process(int arr[10]){"
|
|
460
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
461
|
+
|
|
462
|
+
expect(signature).to eq("void process(int arr[10])")
|
|
463
|
+
expect(pos).to eq(25)
|
|
464
|
+
expect(rest).to eq("{")
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
it "extracts function with const parameter" do
|
|
468
|
+
content = "void print(const char* str){"
|
|
469
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
470
|
+
|
|
471
|
+
expect(signature).to eq("void print(const char* str)")
|
|
472
|
+
expect(pos).to eq(27)
|
|
473
|
+
expect(rest).to eq("{")
|
|
474
|
+
end
|
|
475
|
+
|
|
476
|
+
it "extracts function with struct parameter" do
|
|
477
|
+
content = "void update(struct data d){"
|
|
478
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
479
|
+
|
|
480
|
+
expect(signature).to eq("void update(struct data d)")
|
|
481
|
+
expect(pos).to eq(26)
|
|
482
|
+
expect(rest).to eq("{")
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
it "extracts function with pointer to struct parameter" do
|
|
486
|
+
content = "void modify(struct node* n){"
|
|
487
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
488
|
+
|
|
489
|
+
expect(signature).to eq("void modify(struct node* n)")
|
|
490
|
+
expect(pos).to eq(27)
|
|
491
|
+
expect(rest).to eq("{")
|
|
492
|
+
end
|
|
493
|
+
|
|
494
|
+
it "extracts function with multiple complex parameters" do
|
|
495
|
+
content = "int compare(const char* s1, const char* s2, size_t len){"
|
|
496
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
497
|
+
|
|
498
|
+
expect(signature).to eq("int compare(const char* s1, const char* s2, size_t len)")
|
|
499
|
+
expect(pos).to eq(55)
|
|
500
|
+
expect(rest).to eq("{")
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
it "extracts function with function pointer parameter" do
|
|
504
|
+
content = "void callback(void (*func)(int)){"
|
|
505
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
506
|
+
|
|
507
|
+
expect(signature).to eq("void callback(void (*func)(int))")
|
|
508
|
+
expect(pos).to eq(32)
|
|
509
|
+
expect(rest).to eq("{")
|
|
510
|
+
end
|
|
511
|
+
|
|
512
|
+
it "extracts function with complex function pointer parameter" do
|
|
513
|
+
content = "void register(int (*compare)(const void*, const void*)){"
|
|
514
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
515
|
+
|
|
516
|
+
expect(signature).to eq("void register(int (*compare)(const void*, const void*))")
|
|
517
|
+
expect(pos).to eq(55)
|
|
518
|
+
expect(rest).to eq("{")
|
|
519
|
+
end
|
|
520
|
+
|
|
521
|
+
it "extracts function with double pointer parameter" do
|
|
522
|
+
content = "void allocate(char** buffer){"
|
|
523
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
524
|
+
|
|
525
|
+
expect(signature).to eq("void allocate(char** buffer)")
|
|
526
|
+
expect(pos).to eq(28)
|
|
527
|
+
expect(rest).to eq("{")
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
it "extracts function with enum parameter" do
|
|
531
|
+
content = "void setState(enum state s){"
|
|
532
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
533
|
+
|
|
534
|
+
expect(signature).to eq("void setState(enum state s)")
|
|
535
|
+
expect(pos).to eq(27)
|
|
536
|
+
expect(rest).to eq("{")
|
|
537
|
+
end
|
|
538
|
+
end
|
|
539
|
+
|
|
540
|
+
context "function signatures with storage class specifiers" do
|
|
541
|
+
it "extracts static function" do
|
|
542
|
+
content = "static int helper(void){"
|
|
543
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
544
|
+
|
|
545
|
+
expect(signature).to eq("static int helper(void)")
|
|
546
|
+
expect(pos).to eq(23)
|
|
547
|
+
expect(rest).to eq("{")
|
|
548
|
+
end
|
|
549
|
+
|
|
550
|
+
it "extracts inline function" do
|
|
551
|
+
content = "inline int fast(void){"
|
|
552
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
553
|
+
|
|
554
|
+
expect(signature).to eq("inline int fast(void)")
|
|
555
|
+
expect(pos).to eq(21)
|
|
556
|
+
expect(rest).to eq("{")
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
it "extracts extern function" do
|
|
560
|
+
content = "extern void external(void){"
|
|
561
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
562
|
+
|
|
563
|
+
expect(signature).to eq("extern void external(void)")
|
|
564
|
+
expect(pos).to eq(26)
|
|
565
|
+
expect(rest).to eq("{")
|
|
566
|
+
end
|
|
567
|
+
|
|
568
|
+
it "extracts static inline function" do
|
|
569
|
+
content = "static inline int optimize(void){"
|
|
570
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
571
|
+
|
|
572
|
+
expect(signature).to eq("static inline int optimize(void)")
|
|
573
|
+
expect(pos).to eq(32)
|
|
574
|
+
expect(rest).to eq("{")
|
|
575
|
+
end
|
|
576
|
+
end
|
|
577
|
+
|
|
578
|
+
context "function signatures with qualifiers" do
|
|
579
|
+
it "extracts function with const qualifier" do
|
|
580
|
+
content = "const int getValue(void){"
|
|
581
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
582
|
+
|
|
583
|
+
expect(signature).to eq("const int getValue(void)")
|
|
584
|
+
expect(pos).to eq(24)
|
|
585
|
+
expect(rest).to eq("{")
|
|
586
|
+
end
|
|
587
|
+
|
|
588
|
+
it "extracts function with volatile qualifier" do
|
|
589
|
+
content = "volatile int getRegister(void){"
|
|
590
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
591
|
+
|
|
592
|
+
expect(signature).to eq("volatile int getRegister(void)")
|
|
593
|
+
expect(pos).to eq(30)
|
|
594
|
+
expect(rest).to eq("{")
|
|
595
|
+
end
|
|
596
|
+
|
|
597
|
+
it "extracts function with restrict qualifier" do
|
|
598
|
+
content = "void copy(char* restrict dest, const char* restrict src){"
|
|
599
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
600
|
+
|
|
601
|
+
expect(signature).to eq("void copy(char* restrict dest, const char* restrict src)")
|
|
602
|
+
expect(pos).to eq(56)
|
|
603
|
+
expect(rest).to eq("{")
|
|
604
|
+
end
|
|
605
|
+
|
|
606
|
+
it "extracts function with multiple qualifiers" do
|
|
607
|
+
content = "static const volatile int getSpecial(void){"
|
|
608
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
609
|
+
|
|
610
|
+
expect(signature).to eq("static const volatile int getSpecial(void)")
|
|
611
|
+
expect(pos).to eq(42)
|
|
612
|
+
expect(rest).to eq("{")
|
|
613
|
+
end
|
|
614
|
+
end
|
|
615
|
+
|
|
616
|
+
context "function signatures with variadic parameters" do
|
|
617
|
+
it "extracts function with variadic parameters" do
|
|
618
|
+
content = "int printf(const char* format, ...){"
|
|
619
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
620
|
+
|
|
621
|
+
expect(signature).to eq("int printf(const char* format, ...)")
|
|
622
|
+
expect(pos).to eq(35)
|
|
623
|
+
expect(rest).to eq("{")
|
|
624
|
+
end
|
|
625
|
+
|
|
626
|
+
it "extracts function with only variadic parameters" do
|
|
627
|
+
content = "void log(...){"
|
|
628
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
629
|
+
|
|
630
|
+
expect(signature).to eq("void log(...)")
|
|
631
|
+
expect(pos).to eq(13)
|
|
632
|
+
expect(rest).to eq("{")
|
|
633
|
+
end
|
|
634
|
+
|
|
635
|
+
it "extracts function with multiple parameters and variadic" do
|
|
636
|
+
content = "int sprintf(char* buffer, const char* format, ...){"
|
|
637
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
638
|
+
|
|
639
|
+
expect(signature).to eq("int sprintf(char* buffer, const char* format, ...)")
|
|
640
|
+
expect(pos).to eq(50)
|
|
641
|
+
expect(rest).to eq("{")
|
|
642
|
+
end
|
|
643
|
+
end
|
|
644
|
+
|
|
645
|
+
context "function signatures with nested parentheses" do
|
|
646
|
+
it "extracts signature with function pointer return type" do
|
|
647
|
+
content = "int (*getFunction(void))(int, int){"
|
|
648
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
649
|
+
|
|
650
|
+
expect(signature).to eq("int (*getFunction(void))(int, int)")
|
|
651
|
+
expect(pos).to eq(34)
|
|
652
|
+
expect(rest).to eq("{")
|
|
653
|
+
end
|
|
654
|
+
|
|
655
|
+
it "extracts signature with complex function pointer parameter" do
|
|
656
|
+
content = "void sort(int* array, int (*compare)(int, int)){"
|
|
657
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
658
|
+
|
|
659
|
+
expect(signature).to eq("void sort(int* array, int (*compare)(int, int))")
|
|
660
|
+
expect(pos).to eq(47)
|
|
661
|
+
expect(rest).to eq("{")
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
it "extracts signature with multiple function pointer parameters" do
|
|
665
|
+
content = "void process(void (*init)(void), void (*cleanup)(void)){"
|
|
666
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
667
|
+
|
|
668
|
+
expect(signature).to eq("void process(void (*init)(void), void (*cleanup)(void))")
|
|
669
|
+
expect(pos).to eq(55)
|
|
670
|
+
expect(rest).to eq("{")
|
|
671
|
+
end
|
|
672
|
+
|
|
673
|
+
it "extracts signature with nested function pointers" do
|
|
674
|
+
content = "void register(void (*callback)(int (*)(void))){"
|
|
675
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
676
|
+
|
|
677
|
+
expect(signature).to eq("void register(void (*callback)(int (*)(void)))")
|
|
678
|
+
expect(pos).to eq(46)
|
|
679
|
+
expect(rest).to eq("{")
|
|
680
|
+
end
|
|
681
|
+
|
|
682
|
+
it "extracts signature with array of function pointers" do
|
|
683
|
+
content = "void dispatch(void (*handlers[])(int)){"
|
|
684
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
685
|
+
|
|
686
|
+
expect(signature).to eq("void dispatch(void (*handlers[])(int))")
|
|
687
|
+
expect(pos).to eq(38)
|
|
688
|
+
expect(rest).to eq("{")
|
|
689
|
+
end
|
|
690
|
+
end
|
|
691
|
+
|
|
692
|
+
context "function signatures with strings and comments" do
|
|
693
|
+
it "extracts signature with string in default parameter (C++ style, but testing robustness)" do
|
|
694
|
+
content = 'void log(const char* msg = "default"){'
|
|
695
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
696
|
+
|
|
697
|
+
expect(signature).to eq('void log(const char* msg = "default")')
|
|
698
|
+
expect(pos).to eq(37)
|
|
699
|
+
expect(rest).to eq("{")
|
|
700
|
+
end
|
|
701
|
+
|
|
702
|
+
it "extracts signature with parentheses in string" do
|
|
703
|
+
content = 'void print(const char* format = "value: (%d)"){'
|
|
704
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
705
|
+
|
|
706
|
+
expect(signature).to eq('void print(const char* format = "value: (%d)")')
|
|
707
|
+
expect(pos).to eq(46)
|
|
708
|
+
expect(rest).to eq("{")
|
|
709
|
+
end
|
|
710
|
+
|
|
711
|
+
it "extracts signature with character literal containing parenthesis" do
|
|
712
|
+
content = "void process(char c = ')'){"
|
|
713
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
714
|
+
|
|
715
|
+
expect(signature).to eq("void process(char c = ')')")
|
|
716
|
+
expect(pos).to eq(26)
|
|
717
|
+
expect(rest).to eq("{")
|
|
718
|
+
end
|
|
719
|
+
end
|
|
720
|
+
|
|
721
|
+
context "edge cases and boundary conditions" do
|
|
722
|
+
it "extracts very long signature" do
|
|
723
|
+
params = (1..50).map { |i| "int param#{i}" }.join(", ")
|
|
724
|
+
content = "void longFunction(#{params})"
|
|
725
|
+
signature, pos, rest = extract_signature.call(content + '{}', :definition)
|
|
726
|
+
|
|
727
|
+
expect(signature).to eq(content)
|
|
728
|
+
expect(pos).to eq(content.length)
|
|
729
|
+
expect(rest).to eq("{}")
|
|
730
|
+
end
|
|
731
|
+
|
|
732
|
+
it "extracts signature with deeply nested parentheses" do
|
|
733
|
+
content = "void complex(int (*(*(*f)(int))(int))(int)){"
|
|
734
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
735
|
+
|
|
736
|
+
expect(signature).to eq("void complex(int (*(*(*f)(int))(int))(int))")
|
|
737
|
+
expect(pos).to eq(43)
|
|
738
|
+
expect(rest).to eq("{")
|
|
739
|
+
end
|
|
740
|
+
end
|
|
741
|
+
|
|
742
|
+
context "real-world C function patterns" do
|
|
743
|
+
it "extracts main function signature" do
|
|
744
|
+
content = "int main(int argc, char* argv[]){"
|
|
745
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
746
|
+
|
|
747
|
+
expect(signature).to eq("int main(int argc, char* argv[])")
|
|
748
|
+
expect(pos).to eq(32)
|
|
749
|
+
expect(rest).to eq("{")
|
|
750
|
+
end
|
|
751
|
+
|
|
752
|
+
it "extracts signal handler signature" do
|
|
753
|
+
content = "void signal_handler(int signum){"
|
|
754
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
755
|
+
|
|
756
|
+
expect(signature).to eq("void signal_handler(int signum)")
|
|
757
|
+
expect(pos).to eq(31)
|
|
758
|
+
expect(rest).to eq("{")
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
it "extracts qsort compare function signature" do
|
|
762
|
+
content = "int compare(const void* a, const void* b){"
|
|
763
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
764
|
+
|
|
765
|
+
expect(signature).to eq("int compare(const void* a, const void* b)")
|
|
766
|
+
expect(pos).to eq(41)
|
|
767
|
+
expect(rest).to eq("{")
|
|
768
|
+
end
|
|
769
|
+
|
|
770
|
+
it "extracts pthread function signature" do
|
|
771
|
+
content = "void* thread_function(void* arg){"
|
|
772
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
773
|
+
|
|
774
|
+
expect(signature).to eq("void* thread_function(void* arg)")
|
|
775
|
+
expect(pos).to eq(32)
|
|
776
|
+
expect(rest).to eq("{")
|
|
777
|
+
end
|
|
778
|
+
|
|
779
|
+
it "extracts interrupt handler signature" do
|
|
780
|
+
content = "void __attribute__((interrupt)) ISR_Handler(void){"
|
|
781
|
+
signature, pos, rest = extract_signature.call(content, :definition)
|
|
782
|
+
|
|
783
|
+
expect(signature).to eq("void __attribute__((interrupt)) ISR_Handler(void)")
|
|
784
|
+
expect(pos).to eq(49)
|
|
785
|
+
expect(rest).to eq("{")
|
|
786
|
+
end
|
|
787
|
+
end
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
###
|
|
791
|
+
### extract_function_name()
|
|
792
|
+
###
|
|
793
|
+
|
|
794
|
+
describe "#extract_function_name (private method testing)" do
|
|
795
|
+
# Helper to access private method
|
|
796
|
+
let(:parse_name) do
|
|
797
|
+
->(signature) do
|
|
798
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
799
|
+
functions.setup()
|
|
800
|
+
functions.max_line_length = 1000
|
|
801
|
+
name = functions.send( :extract_function_name, signature )
|
|
802
|
+
return name
|
|
803
|
+
end
|
|
804
|
+
end
|
|
805
|
+
|
|
806
|
+
context "simple function names" do
|
|
807
|
+
it "extracts name from void function with void parameters" do
|
|
808
|
+
signature = "void foo(void)"
|
|
809
|
+
name = parse_name.call(signature)
|
|
810
|
+
|
|
811
|
+
expect(name).to eq("foo")
|
|
812
|
+
end
|
|
813
|
+
|
|
814
|
+
it "extracts name from int function with no parameters" do
|
|
815
|
+
signature = "int bar()"
|
|
816
|
+
name = parse_name.call(signature)
|
|
817
|
+
|
|
818
|
+
expect(name).to eq("bar")
|
|
819
|
+
end
|
|
820
|
+
|
|
821
|
+
it "extracts name from function with single parameter" do
|
|
822
|
+
signature = "int add(int x)"
|
|
823
|
+
name = parse_name.call(signature)
|
|
824
|
+
|
|
825
|
+
expect(name).to eq("add")
|
|
826
|
+
end
|
|
827
|
+
|
|
828
|
+
it "extracts name from function with multiple parameters" do
|
|
829
|
+
signature = "int multiply(int a, int b)"
|
|
830
|
+
name = parse_name.call(signature)
|
|
831
|
+
|
|
832
|
+
expect(name).to eq("multiply")
|
|
833
|
+
end
|
|
834
|
+
|
|
835
|
+
it "extracts name from function returning pointer" do
|
|
836
|
+
signature = "char* getString(void)"
|
|
837
|
+
name = parse_name.call(signature)
|
|
838
|
+
|
|
839
|
+
expect(name).to eq("getString")
|
|
840
|
+
end
|
|
841
|
+
|
|
842
|
+
it "extracts name from function with pointer parameter" do
|
|
843
|
+
signature = "void process(int* ptr)"
|
|
844
|
+
name = parse_name.call(signature)
|
|
845
|
+
|
|
846
|
+
expect(name).to eq("process")
|
|
847
|
+
end
|
|
848
|
+
end
|
|
849
|
+
|
|
850
|
+
context "function names with whitespace variations" do
|
|
851
|
+
it "extracts name with extra spaces before parenthesis" do
|
|
852
|
+
signature = "int foo (int x)"
|
|
853
|
+
name = parse_name.call(signature)
|
|
854
|
+
|
|
855
|
+
expect(name).to eq("foo")
|
|
856
|
+
end
|
|
857
|
+
|
|
858
|
+
it "extracts name with tabs before parenthesis" do
|
|
859
|
+
signature = "int\tfoo\t(int x)"
|
|
860
|
+
name = parse_name.call(signature)
|
|
861
|
+
|
|
862
|
+
expect(name).to eq("foo")
|
|
863
|
+
end
|
|
864
|
+
|
|
865
|
+
it "extracts name with newlines before parenthesis" do
|
|
866
|
+
signature = "int\nfoo\n(int x)"
|
|
867
|
+
name = parse_name.call(signature)
|
|
868
|
+
|
|
869
|
+
expect(name).to eq("foo")
|
|
870
|
+
end
|
|
871
|
+
|
|
872
|
+
it "extracts name with mixed whitespace" do
|
|
873
|
+
signature = "int \t\n foo \t\n (int x)"
|
|
874
|
+
name = parse_name.call(signature)
|
|
875
|
+
|
|
876
|
+
expect(name).to eq("foo")
|
|
877
|
+
end
|
|
878
|
+
end
|
|
879
|
+
|
|
880
|
+
context "complex return types" do
|
|
881
|
+
it "extracts name from function returning struct" do
|
|
882
|
+
signature = "struct point getPoint(void)"
|
|
883
|
+
name = parse_name.call(signature)
|
|
884
|
+
|
|
885
|
+
expect(name).to eq("getPoint")
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
it "extracts name from function returning pointer to struct" do
|
|
889
|
+
signature = "struct node* getNode(void)"
|
|
890
|
+
name = parse_name.call(signature)
|
|
891
|
+
|
|
892
|
+
expect(name).to eq("getNode")
|
|
893
|
+
end
|
|
894
|
+
|
|
895
|
+
it "extracts name from function returning const pointer" do
|
|
896
|
+
signature = "const char* getMessage(void)"
|
|
897
|
+
name = parse_name.call(signature)
|
|
898
|
+
|
|
899
|
+
expect(name).to eq("getMessage")
|
|
900
|
+
end
|
|
901
|
+
|
|
902
|
+
it "extracts name from function returning pointer to const" do
|
|
903
|
+
signature = "char* const getBuffer(void)"
|
|
904
|
+
name = parse_name.call(signature)
|
|
905
|
+
|
|
906
|
+
expect(name).to eq("getBuffer")
|
|
907
|
+
end
|
|
908
|
+
|
|
909
|
+
it "extracts name from function returning unsigned type" do
|
|
910
|
+
signature = "unsigned int getValue(void)"
|
|
911
|
+
name = parse_name.call(signature)
|
|
912
|
+
|
|
913
|
+
expect(name).to eq("getValue")
|
|
914
|
+
end
|
|
915
|
+
|
|
916
|
+
it "extracts name from function returning long long" do
|
|
917
|
+
signature = "long long getBigValue(void)"
|
|
918
|
+
name = parse_name.call(signature)
|
|
919
|
+
|
|
920
|
+
expect(name).to eq("getBigValue")
|
|
921
|
+
end
|
|
922
|
+
|
|
923
|
+
it "extracts name from function returning enum" do
|
|
924
|
+
signature = "enum status getStatus(void)"
|
|
925
|
+
name = parse_name.call(signature)
|
|
926
|
+
|
|
927
|
+
expect(name).to eq("getStatus")
|
|
928
|
+
end
|
|
929
|
+
|
|
930
|
+
it "extracts name from function returning typedef'd type" do
|
|
931
|
+
signature = "size_t getSize(void)"
|
|
932
|
+
name = parse_name.call(signature)
|
|
933
|
+
|
|
934
|
+
expect(name).to eq("getSize")
|
|
935
|
+
end
|
|
936
|
+
|
|
937
|
+
it "extracts name from function returning double pointer" do
|
|
938
|
+
signature = "char** getStringArray(void)"
|
|
939
|
+
name = parse_name.call(signature)
|
|
940
|
+
|
|
941
|
+
expect(name).to eq("getStringArray")
|
|
942
|
+
end
|
|
943
|
+
end
|
|
944
|
+
|
|
945
|
+
context "function names with storage class specifiers" do
|
|
946
|
+
it "extracts name from static function" do
|
|
947
|
+
signature = "static int helper(void)"
|
|
948
|
+
name = parse_name.call(signature)
|
|
949
|
+
|
|
950
|
+
expect(name).to eq("helper")
|
|
951
|
+
end
|
|
952
|
+
|
|
953
|
+
it "extracts name from inline function" do
|
|
954
|
+
signature = "inline int fast(void)"
|
|
955
|
+
name = parse_name.call(signature)
|
|
956
|
+
|
|
957
|
+
expect(name).to eq("fast")
|
|
958
|
+
end
|
|
959
|
+
|
|
960
|
+
it "extracts name from extern function" do
|
|
961
|
+
signature = "extern void external(void)"
|
|
962
|
+
name = parse_name.call(signature)
|
|
963
|
+
|
|
964
|
+
expect(name).to eq("external")
|
|
965
|
+
end
|
|
966
|
+
|
|
967
|
+
it "extracts name from static inline function" do
|
|
968
|
+
signature = "static inline int optimize(void)"
|
|
969
|
+
name = parse_name.call(signature)
|
|
970
|
+
|
|
971
|
+
expect(name).to eq("optimize")
|
|
972
|
+
end
|
|
973
|
+
end
|
|
974
|
+
|
|
975
|
+
context "function names with qualifiers" do
|
|
976
|
+
it "extracts name from function with const qualifier" do
|
|
977
|
+
signature = "const int getValue(void)"
|
|
978
|
+
name = parse_name.call(signature)
|
|
979
|
+
|
|
980
|
+
expect(name).to eq("getValue")
|
|
981
|
+
end
|
|
982
|
+
|
|
983
|
+
it "extracts name from function with volatile qualifier" do
|
|
984
|
+
signature = "volatile int getRegister(void)"
|
|
985
|
+
name = parse_name.call(signature)
|
|
986
|
+
|
|
987
|
+
expect(name).to eq("getRegister")
|
|
988
|
+
end
|
|
989
|
+
|
|
990
|
+
it "extracts name from function with multiple qualifiers" do
|
|
991
|
+
signature = "static const volatile int getSpecial(void)"
|
|
992
|
+
name = parse_name.call(signature)
|
|
993
|
+
|
|
994
|
+
expect(name).to eq("getSpecial")
|
|
995
|
+
end
|
|
996
|
+
end
|
|
997
|
+
|
|
998
|
+
context "function names with nested parentheses" do
|
|
999
|
+
it "extracts name from function pointer return type" do
|
|
1000
|
+
signature = "int (*getFunction(void))(int, int)"
|
|
1001
|
+
name = parse_name.call(signature)
|
|
1002
|
+
|
|
1003
|
+
expect(name).to eq("getFunction")
|
|
1004
|
+
end
|
|
1005
|
+
|
|
1006
|
+
it "extracts name from function with function pointer parameter" do
|
|
1007
|
+
signature = "void sort(int* array, int (*compare)(int, int))"
|
|
1008
|
+
name = parse_name.call(signature)
|
|
1009
|
+
|
|
1010
|
+
expect(name).to eq("sort")
|
|
1011
|
+
end
|
|
1012
|
+
|
|
1013
|
+
it "extracts name from function with multiple function pointer parameters" do
|
|
1014
|
+
signature = "void process(void (*init)(void), void (*cleanup)(void))"
|
|
1015
|
+
name = parse_name.call(signature)
|
|
1016
|
+
|
|
1017
|
+
expect(name).to eq("process")
|
|
1018
|
+
end
|
|
1019
|
+
|
|
1020
|
+
it "extracts name from function with nested function pointers" do
|
|
1021
|
+
signature = "void register(void (*callback)(int (*)(void)))"
|
|
1022
|
+
name = parse_name.call(signature)
|
|
1023
|
+
|
|
1024
|
+
expect(name).to eq("register")
|
|
1025
|
+
end
|
|
1026
|
+
|
|
1027
|
+
it "extracts name from function with array of function pointers" do
|
|
1028
|
+
signature = "void dispatch(void (*handlers[])(int))"
|
|
1029
|
+
name = parse_name.call(signature)
|
|
1030
|
+
|
|
1031
|
+
expect(name).to eq("dispatch")
|
|
1032
|
+
end
|
|
1033
|
+
end
|
|
1034
|
+
|
|
1035
|
+
context "function names with underscores and naming conventions" do
|
|
1036
|
+
it "extracts name with leading underscore" do
|
|
1037
|
+
signature = "void _internal(void)"
|
|
1038
|
+
name = parse_name.call(signature)
|
|
1039
|
+
|
|
1040
|
+
expect(name).to eq("_internal")
|
|
1041
|
+
end
|
|
1042
|
+
|
|
1043
|
+
it "extracts name with double leading underscore" do
|
|
1044
|
+
signature = "void __private(void)"
|
|
1045
|
+
name = parse_name.call(signature)
|
|
1046
|
+
|
|
1047
|
+
expect(name).to eq("__private")
|
|
1048
|
+
end
|
|
1049
|
+
|
|
1050
|
+
it "extracts name with trailing underscore" do
|
|
1051
|
+
signature = "void function_(void)"
|
|
1052
|
+
name = parse_name.call(signature)
|
|
1053
|
+
|
|
1054
|
+
expect(name).to eq("function_")
|
|
1055
|
+
end
|
|
1056
|
+
|
|
1057
|
+
it "extracts name with multiple underscores" do
|
|
1058
|
+
signature = "void my_long_function_name(void)"
|
|
1059
|
+
name = parse_name.call(signature)
|
|
1060
|
+
|
|
1061
|
+
expect(name).to eq("my_long_function_name")
|
|
1062
|
+
end
|
|
1063
|
+
|
|
1064
|
+
it "extracts camelCase name" do
|
|
1065
|
+
signature = "void myFunctionName(void)"
|
|
1066
|
+
name = parse_name.call(signature)
|
|
1067
|
+
|
|
1068
|
+
expect(name).to eq("myFunctionName")
|
|
1069
|
+
end
|
|
1070
|
+
|
|
1071
|
+
it "extracts PascalCase name" do
|
|
1072
|
+
signature = "void MyFunctionName(void)"
|
|
1073
|
+
name = parse_name.call(signature)
|
|
1074
|
+
|
|
1075
|
+
expect(name).to eq("MyFunctionName")
|
|
1076
|
+
end
|
|
1077
|
+
|
|
1078
|
+
it "extracts UPPER_CASE name" do
|
|
1079
|
+
signature = "void MY_FUNCTION(void)"
|
|
1080
|
+
name = parse_name.call(signature)
|
|
1081
|
+
|
|
1082
|
+
expect(name).to eq("MY_FUNCTION")
|
|
1083
|
+
end
|
|
1084
|
+
end
|
|
1085
|
+
|
|
1086
|
+
context "function names with numbers" do
|
|
1087
|
+
it "extracts name with trailing number" do
|
|
1088
|
+
signature = "void function1(void)"
|
|
1089
|
+
name = parse_name.call(signature)
|
|
1090
|
+
|
|
1091
|
+
expect(name).to eq("function1")
|
|
1092
|
+
end
|
|
1093
|
+
|
|
1094
|
+
it "extracts name with embedded numbers" do
|
|
1095
|
+
signature = "void func2tion3(void)"
|
|
1096
|
+
name = parse_name.call(signature)
|
|
1097
|
+
|
|
1098
|
+
expect(name).to eq("func2tion3")
|
|
1099
|
+
end
|
|
1100
|
+
|
|
1101
|
+
it "extracts name with multiple numbers" do
|
|
1102
|
+
signature = "void test123(void)"
|
|
1103
|
+
name = parse_name.call(signature)
|
|
1104
|
+
|
|
1105
|
+
expect(name).to eq("test123")
|
|
1106
|
+
end
|
|
1107
|
+
end
|
|
1108
|
+
|
|
1109
|
+
context "real-world C function patterns" do
|
|
1110
|
+
it "extracts name from main function" do
|
|
1111
|
+
signature = "int main(int argc, char* argv[])"
|
|
1112
|
+
name = parse_name.call(signature)
|
|
1113
|
+
|
|
1114
|
+
expect(name).to eq("main")
|
|
1115
|
+
end
|
|
1116
|
+
|
|
1117
|
+
it "extracts name from signal handler" do
|
|
1118
|
+
signature = "void signal_handler(int signum)"
|
|
1119
|
+
name = parse_name.call(signature)
|
|
1120
|
+
|
|
1121
|
+
expect(name).to eq("signal_handler")
|
|
1122
|
+
end
|
|
1123
|
+
|
|
1124
|
+
it "extracts name from qsort compare function" do
|
|
1125
|
+
signature = "int compare(const void* a, const void* b)"
|
|
1126
|
+
name = parse_name.call(signature)
|
|
1127
|
+
|
|
1128
|
+
expect(name).to eq("compare")
|
|
1129
|
+
end
|
|
1130
|
+
|
|
1131
|
+
it "extracts name from pthread function" do
|
|
1132
|
+
signature = "void* thread_function(void* arg)"
|
|
1133
|
+
name = parse_name.call(signature)
|
|
1134
|
+
|
|
1135
|
+
expect(name).to eq("thread_function")
|
|
1136
|
+
end
|
|
1137
|
+
|
|
1138
|
+
it "extracts name from interrupt handler with attributes" do
|
|
1139
|
+
signature = "void __attribute__((interrupt)) ISR_Handler(void)"
|
|
1140
|
+
name = parse_name.call(signature)
|
|
1141
|
+
|
|
1142
|
+
expect(name).to eq("ISR_Handler")
|
|
1143
|
+
end
|
|
1144
|
+
|
|
1145
|
+
it "extracts name from constructor function" do
|
|
1146
|
+
signature = "void __attribute__((constructor)) init_module(void)"
|
|
1147
|
+
name = parse_name.call(signature)
|
|
1148
|
+
|
|
1149
|
+
expect(name).to eq("init_module")
|
|
1150
|
+
end
|
|
1151
|
+
|
|
1152
|
+
it "extracts name from destructor function" do
|
|
1153
|
+
signature = "void __attribute__((destructor)) cleanup_module(void)"
|
|
1154
|
+
name = parse_name.call(signature)
|
|
1155
|
+
|
|
1156
|
+
expect(name).to eq("cleanup_module")
|
|
1157
|
+
end
|
|
1158
|
+
end
|
|
1159
|
+
|
|
1160
|
+
context "edge cases" do
|
|
1161
|
+
it "extracts name from very long signature" do
|
|
1162
|
+
params = (1..50).map { |i| "int param#{i}" }.join(", ")
|
|
1163
|
+
signature = "void longFunctionName(#{params})"
|
|
1164
|
+
name = parse_name.call(signature)
|
|
1165
|
+
|
|
1166
|
+
expect(name).to eq("longFunctionName")
|
|
1167
|
+
end
|
|
1168
|
+
|
|
1169
|
+
it "extracts name with deeply nested parentheses in parameters" do
|
|
1170
|
+
signature = "void complex(int (*(*f)(int (*)(void)))(void))"
|
|
1171
|
+
name = parse_name.call(signature)
|
|
1172
|
+
|
|
1173
|
+
expect(name).to eq("complex")
|
|
1174
|
+
end
|
|
1175
|
+
|
|
1176
|
+
it "extracts name from function with array parameters with sizes" do
|
|
1177
|
+
signature = "void matrix(int arr[10][20][30])"
|
|
1178
|
+
name = parse_name.call(signature)
|
|
1179
|
+
|
|
1180
|
+
expect(name).to eq("matrix")
|
|
1181
|
+
end
|
|
1182
|
+
|
|
1183
|
+
it "extracts name from function with variadic parameters" do
|
|
1184
|
+
signature = "int printf(const char* format, ...)"
|
|
1185
|
+
name = parse_name.call(signature)
|
|
1186
|
+
|
|
1187
|
+
expect(name).to eq("printf")
|
|
1188
|
+
end
|
|
1189
|
+
|
|
1190
|
+
it "extracts name from function with restrict qualifier" do
|
|
1191
|
+
signature = "void copy(char* restrict dest, const char* restrict src)"
|
|
1192
|
+
name = parse_name.call(signature)
|
|
1193
|
+
|
|
1194
|
+
expect(name).to eq("copy")
|
|
1195
|
+
end
|
|
1196
|
+
|
|
1197
|
+
it "extracts name from function with _Noreturn specifier" do
|
|
1198
|
+
signature = "_Noreturn void exit_program(int code)"
|
|
1199
|
+
name = parse_name.call(signature)
|
|
1200
|
+
|
|
1201
|
+
expect(name).to eq("exit_program")
|
|
1202
|
+
end
|
|
1203
|
+
|
|
1204
|
+
it "extracts name from function with __declspec" do
|
|
1205
|
+
signature = "__declspec(dllexport) void exported_function(void)"
|
|
1206
|
+
name = parse_name.call(signature)
|
|
1207
|
+
|
|
1208
|
+
expect(name).to eq("exported_function")
|
|
1209
|
+
end
|
|
1210
|
+
|
|
1211
|
+
it "extracts name from function with multiple pointer levels" do
|
|
1212
|
+
signature = "void*** getTriplePointer(void)"
|
|
1213
|
+
name = parse_name.call(signature)
|
|
1214
|
+
|
|
1215
|
+
expect(name).to eq("getTriplePointer")
|
|
1216
|
+
end
|
|
1217
|
+
|
|
1218
|
+
it "extracts name from function with const pointer to const" do
|
|
1219
|
+
signature = "const char* const getConstString(void)"
|
|
1220
|
+
name = parse_name.call(signature)
|
|
1221
|
+
|
|
1222
|
+
expect(name).to eq("getConstString")
|
|
1223
|
+
end
|
|
1224
|
+
|
|
1225
|
+
it "extracts name from function with volatile pointer" do
|
|
1226
|
+
signature = "volatile int* getVolatilePtr(void)"
|
|
1227
|
+
name = parse_name.call(signature)
|
|
1228
|
+
|
|
1229
|
+
expect(name).to eq("getVolatilePtr")
|
|
1230
|
+
end
|
|
1231
|
+
|
|
1232
|
+
it "extracts name from function with struct tag and pointer" do
|
|
1233
|
+
signature = "struct my_struct* create_struct(void)"
|
|
1234
|
+
name = parse_name.call(signature)
|
|
1235
|
+
|
|
1236
|
+
expect(name).to eq("create_struct")
|
|
1237
|
+
end
|
|
1238
|
+
|
|
1239
|
+
it "extracts name from function with union return type" do
|
|
1240
|
+
signature = "union data getData(void)"
|
|
1241
|
+
name = parse_name.call(signature)
|
|
1242
|
+
|
|
1243
|
+
expect(name).to eq("getData")
|
|
1244
|
+
end
|
|
1245
|
+
|
|
1246
|
+
it "extracts name from function with typedef'd struct" do
|
|
1247
|
+
signature = "MyStruct_t createMyStruct(void)"
|
|
1248
|
+
name = parse_name.call(signature)
|
|
1249
|
+
|
|
1250
|
+
expect(name).to eq("createMyStruct")
|
|
1251
|
+
end
|
|
1252
|
+
|
|
1253
|
+
it "extracts name from function with anonymous struct parameter" do
|
|
1254
|
+
signature = "void process(struct { int x; int y; } point)"
|
|
1255
|
+
name = parse_name.call(signature)
|
|
1256
|
+
|
|
1257
|
+
expect(name).to eq("process")
|
|
1258
|
+
end
|
|
1259
|
+
|
|
1260
|
+
it "extracts name from function with bit field in struct parameter" do
|
|
1261
|
+
signature = "void setBits(struct flags { unsigned int a:1; unsigned int b:1; } f)"
|
|
1262
|
+
name = parse_name.call(signature)
|
|
1263
|
+
|
|
1264
|
+
expect(name).to eq("setBits")
|
|
1265
|
+
end
|
|
1266
|
+
|
|
1267
|
+
it "extracts name from function with complex spacing around asterisks" do
|
|
1268
|
+
signature = "char * * * getMultiPointer(void)"
|
|
1269
|
+
name = parse_name.call(signature)
|
|
1270
|
+
|
|
1271
|
+
expect(name).to eq("getMultiPointer")
|
|
1272
|
+
end
|
|
1273
|
+
|
|
1274
|
+
it "extracts name from function with register storage class" do
|
|
1275
|
+
signature = "register int fastFunction(void)"
|
|
1276
|
+
name = parse_name.call(signature)
|
|
1277
|
+
|
|
1278
|
+
expect(name).to eq("fastFunction")
|
|
1279
|
+
end
|
|
1280
|
+
|
|
1281
|
+
it "extracts name from function with auto storage class" do
|
|
1282
|
+
signature = "auto void localFunction(void)"
|
|
1283
|
+
name = parse_name.call(signature)
|
|
1284
|
+
|
|
1285
|
+
expect(name).to eq("localFunction")
|
|
1286
|
+
end
|
|
1287
|
+
|
|
1288
|
+
it "extracts name from function with _Thread_local specifier" do
|
|
1289
|
+
signature = "_Thread_local int getThreadLocal(void)"
|
|
1290
|
+
name = parse_name.call(signature)
|
|
1291
|
+
|
|
1292
|
+
expect(name).to eq("getThreadLocal")
|
|
1293
|
+
end
|
|
1294
|
+
|
|
1295
|
+
it "extracts name from function with _Atomic qualifier" do
|
|
1296
|
+
signature = "_Atomic int getAtomic(void)"
|
|
1297
|
+
name = parse_name.call(signature)
|
|
1298
|
+
|
|
1299
|
+
expect(name).to eq("getAtomic")
|
|
1300
|
+
end
|
|
1301
|
+
|
|
1302
|
+
it "extracts name from function with _Bool return type" do
|
|
1303
|
+
signature = "_Bool isValid(void)"
|
|
1304
|
+
name = parse_name.call(signature)
|
|
1305
|
+
|
|
1306
|
+
expect(name).to eq("isValid")
|
|
1307
|
+
end
|
|
1308
|
+
|
|
1309
|
+
it "extracts name from function with _Complex type" do
|
|
1310
|
+
signature = "double _Complex getComplex(void)"
|
|
1311
|
+
name = parse_name.call(signature)
|
|
1312
|
+
|
|
1313
|
+
expect(name).to eq("getComplex")
|
|
1314
|
+
end
|
|
1315
|
+
|
|
1316
|
+
it "extracts name from function with _Imaginary type" do
|
|
1317
|
+
signature = "double _Imaginary getImaginary(void)"
|
|
1318
|
+
name = parse_name.call(signature)
|
|
1319
|
+
|
|
1320
|
+
expect(name).to eq("getImaginary")
|
|
1321
|
+
end
|
|
1322
|
+
|
|
1323
|
+
it "extracts name from function with GCC __attribute__ before name" do
|
|
1324
|
+
signature = "void __attribute__((always_inline)) inlineFunc(void)"
|
|
1325
|
+
name = parse_name.call(signature)
|
|
1326
|
+
|
|
1327
|
+
expect(name).to eq("inlineFunc")
|
|
1328
|
+
end
|
|
1329
|
+
|
|
1330
|
+
it "extracts name from function with multiple __attribute__ specifiers" do
|
|
1331
|
+
signature = "void __attribute__((noreturn)) __attribute__((cold)) exitFunc(void)"
|
|
1332
|
+
name = parse_name.call(signature)
|
|
1333
|
+
|
|
1334
|
+
expect(name).to eq("exitFunc")
|
|
1335
|
+
end
|
|
1336
|
+
|
|
1337
|
+
it "extracts name from function with __asm__ label" do
|
|
1338
|
+
signature = "void myFunction(void) __asm__(\"_myFunction\")"
|
|
1339
|
+
name = parse_name.call(signature)
|
|
1340
|
+
|
|
1341
|
+
expect(name).to eq("myFunction")
|
|
1342
|
+
end
|
|
1343
|
+
|
|
1344
|
+
it "extracts name from function with Windows calling convention" do
|
|
1345
|
+
signature = "void __stdcall WindowsFunc(void)"
|
|
1346
|
+
name = parse_name.call(signature)
|
|
1347
|
+
|
|
1348
|
+
expect(name).to eq("WindowsFunc")
|
|
1349
|
+
end
|
|
1350
|
+
|
|
1351
|
+
it "extracts name from function with __cdecl calling convention" do
|
|
1352
|
+
signature = "void __cdecl CFunc(void)"
|
|
1353
|
+
name = parse_name.call(signature)
|
|
1354
|
+
|
|
1355
|
+
expect(name).to eq("CFunc")
|
|
1356
|
+
end
|
|
1357
|
+
|
|
1358
|
+
it "extracts name from function with __fastcall calling convention" do
|
|
1359
|
+
signature = "void __fastcall FastFunc(void)"
|
|
1360
|
+
name = parse_name.call(signature)
|
|
1361
|
+
|
|
1362
|
+
expect(name).to eq("FastFunc")
|
|
1363
|
+
end
|
|
1364
|
+
|
|
1365
|
+
it "extracts name from function with mixed qualifiers and specifiers" do
|
|
1366
|
+
signature = "static inline const volatile unsigned long long int complexFunc(void)"
|
|
1367
|
+
name = parse_name.call(signature)
|
|
1368
|
+
|
|
1369
|
+
expect(name).to eq("complexFunc")
|
|
1370
|
+
end
|
|
1371
|
+
|
|
1372
|
+
it "extracts name from function with array of pointers parameter" do
|
|
1373
|
+
signature = "void processArray(int* arr[10])"
|
|
1374
|
+
name = parse_name.call(signature)
|
|
1375
|
+
|
|
1376
|
+
expect(name).to eq("processArray")
|
|
1377
|
+
end
|
|
1378
|
+
|
|
1379
|
+
it "extracts name from function with pointer to array parameter" do
|
|
1380
|
+
signature = "void processPointerToArray(int (*arr)[10])"
|
|
1381
|
+
name = parse_name.call(signature)
|
|
1382
|
+
|
|
1383
|
+
expect(name).to eq("processPointerToArray")
|
|
1384
|
+
end
|
|
1385
|
+
|
|
1386
|
+
it "extracts name from function with array of function pointers" do
|
|
1387
|
+
signature = "void dispatch(void (*handlers[10])(int))"
|
|
1388
|
+
name = parse_name.call(signature)
|
|
1389
|
+
|
|
1390
|
+
expect(name).to eq("dispatch")
|
|
1391
|
+
end
|
|
1392
|
+
|
|
1393
|
+
it "extracts name from function returning pointer to array" do
|
|
1394
|
+
signature = "int (*getArray(void))[10]"
|
|
1395
|
+
name = parse_name.call(signature)
|
|
1396
|
+
|
|
1397
|
+
expect(name).to eq("getArray")
|
|
1398
|
+
end
|
|
1399
|
+
|
|
1400
|
+
it "extracts name from function with VLA parameter" do
|
|
1401
|
+
signature = "void processVLA(int n, int arr[n])"
|
|
1402
|
+
name = parse_name.call(signature)
|
|
1403
|
+
|
|
1404
|
+
expect(name).to eq("processVLA")
|
|
1405
|
+
end
|
|
1406
|
+
|
|
1407
|
+
it "extracts name from function with static array parameter" do
|
|
1408
|
+
signature = "void processStatic(int arr[static 10])"
|
|
1409
|
+
name = parse_name.call(signature)
|
|
1410
|
+
|
|
1411
|
+
expect(name).to eq("processStatic")
|
|
1412
|
+
end
|
|
1413
|
+
|
|
1414
|
+
it "extracts name from function with restrict and const" do
|
|
1415
|
+
signature = "void copy(char* restrict const dest, const char* restrict src)"
|
|
1416
|
+
name = parse_name.call(signature)
|
|
1417
|
+
|
|
1418
|
+
expect(name).to eq("copy")
|
|
1419
|
+
end
|
|
1420
|
+
end
|
|
1421
|
+
|
|
1422
|
+
context "malformed or unusual signatures" do
|
|
1423
|
+
it "returns nil for empty signature" do
|
|
1424
|
+
signature = ""
|
|
1425
|
+
name = parse_name.call(signature)
|
|
1426
|
+
|
|
1427
|
+
expect(name).to be_nil
|
|
1428
|
+
end
|
|
1429
|
+
|
|
1430
|
+
it "returns nil for signature with no parentheses" do
|
|
1431
|
+
signature = "void foo"
|
|
1432
|
+
name = parse_name.call(signature)
|
|
1433
|
+
|
|
1434
|
+
expect(name).to be_nil
|
|
1435
|
+
end
|
|
1436
|
+
|
|
1437
|
+
it "returns nil for signature with only return type" do
|
|
1438
|
+
signature = "int"
|
|
1439
|
+
name = parse_name.call(signature)
|
|
1440
|
+
|
|
1441
|
+
expect(name).to be_nil
|
|
1442
|
+
end
|
|
1443
|
+
|
|
1444
|
+
it "returns nil for signature with only opening parenthesis" do
|
|
1445
|
+
signature = "void foo("
|
|
1446
|
+
name = parse_name.call(signature)
|
|
1447
|
+
|
|
1448
|
+
expect(name).to be_nil
|
|
1449
|
+
end
|
|
1450
|
+
|
|
1451
|
+
it "return nil for signature with unbalanced parentheses" do
|
|
1452
|
+
signature = "void foo(int x"
|
|
1453
|
+
name = parse_name.call(signature)
|
|
1454
|
+
|
|
1455
|
+
expect(name).to be_nil
|
|
1456
|
+
end
|
|
1457
|
+
end
|
|
1458
|
+
|
|
1459
|
+
context "MSVC __forceinline specifier" do
|
|
1460
|
+
it "extracts name from __forceinline prefixed function" do
|
|
1461
|
+
name = parse_name.call("__forceinline void foo(void)")
|
|
1462
|
+
expect(name).to eq("foo")
|
|
1463
|
+
end
|
|
1464
|
+
|
|
1465
|
+
it "extracts name from static __forceinline function" do
|
|
1466
|
+
name = parse_name.call("static __forceinline int compute(int x)")
|
|
1467
|
+
expect(name).to eq("compute")
|
|
1468
|
+
end
|
|
1469
|
+
|
|
1470
|
+
it "extracts name from __forceinline with pointer return type" do
|
|
1471
|
+
name = parse_name.call("__forceinline char* getStr(void)")
|
|
1472
|
+
expect(name).to eq("getStr")
|
|
1473
|
+
end
|
|
1474
|
+
end
|
|
1475
|
+
end
|
|
1476
|
+
|
|
1477
|
+
###
|
|
1478
|
+
### try_extract_function_definition()
|
|
1479
|
+
###
|
|
1480
|
+
|
|
1481
|
+
describe "#try_extract_function_definition" do
|
|
1482
|
+
# Helper to access private method and extract function from content
|
|
1483
|
+
let(:try_extract) do
|
|
1484
|
+
->(content, filepath='/path/to/source.c') do
|
|
1485
|
+
scanner = StringScanner.new(content)
|
|
1486
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
1487
|
+
functions.setup()
|
|
1488
|
+
functions.max_line_length = 1000
|
|
1489
|
+
success, func = functions.try_extract_function_definition( scanner, filepath )
|
|
1490
|
+
return [success, func, scanner.pos, scanner.rest]
|
|
1491
|
+
end
|
|
1492
|
+
end
|
|
1493
|
+
|
|
1494
|
+
context "successful function extraction" do
|
|
1495
|
+
it "extracts simple void function" do
|
|
1496
|
+
content = "void foo(void) { int a = 1; }"
|
|
1497
|
+
success, func, pos, rest = try_extract.call(content)
|
|
1498
|
+
|
|
1499
|
+
expect(success).to be true
|
|
1500
|
+
expect(func.name).to eq("foo")
|
|
1501
|
+
expect(func.signature).to eq("void foo(void)")
|
|
1502
|
+
expect(func.body).to eq("{ int a = 1; }")
|
|
1503
|
+
expect(func.code_block).to eq(content)
|
|
1504
|
+
expect(func.line_count).to eq(1)
|
|
1505
|
+
expect(func.source_filepath).to eq('/path/to/source.c')
|
|
1506
|
+
expect(pos).to eq(content.length)
|
|
1507
|
+
expect(rest).to eq("")
|
|
1508
|
+
end
|
|
1509
|
+
|
|
1510
|
+
it "assigns source_filepath from filepath argument" do
|
|
1511
|
+
content = "void foo(void) { return; }"
|
|
1512
|
+
success, func, _, _ = try_extract.call(content, '/custom/path/module.c')
|
|
1513
|
+
|
|
1514
|
+
expect(success).to be true
|
|
1515
|
+
expect(func.source_filepath).to eq('/custom/path/module.c')
|
|
1516
|
+
end
|
|
1517
|
+
|
|
1518
|
+
it "extracts function with return value" do
|
|
1519
|
+
content = "int add(int a, int b) { return a + b; }"
|
|
1520
|
+
success, func, _, _ = try_extract.call(content)
|
|
1521
|
+
|
|
1522
|
+
expect(success).to be true
|
|
1523
|
+
expect(func.name).to eq("add")
|
|
1524
|
+
expect(func.signature).to eq("int add(int a, int b)")
|
|
1525
|
+
expect(func.body).to eq("{ return a + b; }")
|
|
1526
|
+
expect(func.code_block).to eq(content)
|
|
1527
|
+
expect(func.line_count).to eq(1)
|
|
1528
|
+
end
|
|
1529
|
+
|
|
1530
|
+
it "extracts multi-line function" do
|
|
1531
|
+
content = <<~CONTENT
|
|
1532
|
+
void process(void) {
|
|
1533
|
+
int x = 1;
|
|
1534
|
+
int y = 2;
|
|
1535
|
+
return x + y;
|
|
1536
|
+
}
|
|
1537
|
+
CONTENT
|
|
1538
|
+
|
|
1539
|
+
success, func, _, _ = try_extract.call(content)
|
|
1540
|
+
|
|
1541
|
+
expect(success).to be true
|
|
1542
|
+
expect(func.name).to eq("process")
|
|
1543
|
+
expect(func.signature).to eq("void process(void)")
|
|
1544
|
+
expect(func.body).to eq("{\n int x = 1;\n int y = 2;\n return x + y;\n}")
|
|
1545
|
+
expect(func.code_block).to eq(content.strip())
|
|
1546
|
+
expect(func.line_count).to eq(5)
|
|
1547
|
+
end
|
|
1548
|
+
|
|
1549
|
+
it "extracts function with nested braces" do
|
|
1550
|
+
content = "void nested(void) { if (x) { do_something(); } }"
|
|
1551
|
+
success, func, _, _ = try_extract.call(content)
|
|
1552
|
+
|
|
1553
|
+
expect(success).to be true
|
|
1554
|
+
expect(func.name).to eq("nested")
|
|
1555
|
+
expect(func.signature).to eq("void nested(void)")
|
|
1556
|
+
expect(func.code_block).to eq(content)
|
|
1557
|
+
expect(func.body).to eq("{ if (x) { do_something(); } }")
|
|
1558
|
+
end
|
|
1559
|
+
|
|
1560
|
+
it "extracts function with complex parameters" do
|
|
1561
|
+
content = "void callback(void (*func)(int), int* data) { func(*data); }"
|
|
1562
|
+
success, func, _, _ = try_extract.call(content)
|
|
1563
|
+
|
|
1564
|
+
expect(success).to be true
|
|
1565
|
+
expect(func.name).to eq("callback")
|
|
1566
|
+
expect(func.signature).to eq("void callback(void (*func)(int), int* data)")
|
|
1567
|
+
expect(func.body).to eq("{ func(*data); }")
|
|
1568
|
+
expect(func.code_block).to eq(content)
|
|
1569
|
+
end
|
|
1570
|
+
|
|
1571
|
+
it "extracts function with pointer return type" do
|
|
1572
|
+
content = "char* getString(void) { return \"hello\"; }"
|
|
1573
|
+
success, func, _, _ = try_extract.call(content)
|
|
1574
|
+
|
|
1575
|
+
expect(success).to be true
|
|
1576
|
+
expect(func.name).to eq("getString")
|
|
1577
|
+
expect(func.signature).to eq("char* getString(void)")
|
|
1578
|
+
expect(func.body).to eq("{ return \"hello\"; }")
|
|
1579
|
+
expect(func.code_block).to eq(content)
|
|
1580
|
+
end
|
|
1581
|
+
|
|
1582
|
+
it "extracts function with struct return type" do
|
|
1583
|
+
content = "struct point getPoint(void) { struct point p = {0, 0}; return p; }"
|
|
1584
|
+
success, func, _, _ = try_extract.call(content)
|
|
1585
|
+
|
|
1586
|
+
expect(success).to be true
|
|
1587
|
+
expect(func.name).to eq("getPoint")
|
|
1588
|
+
expect(func.signature).to eq("struct point getPoint(void)")
|
|
1589
|
+
expect(func.body).to eq("{ struct point p = {0, 0}; return p; }")
|
|
1590
|
+
expect(func.code_block).to eq(content)
|
|
1591
|
+
end
|
|
1592
|
+
|
|
1593
|
+
it "extracts static function" do
|
|
1594
|
+
content = "static int helper(void) { return 42; }"
|
|
1595
|
+
success, func, _, _ = try_extract.call(content)
|
|
1596
|
+
|
|
1597
|
+
expect(success).to be true
|
|
1598
|
+
expect(func.name).to eq("helper")
|
|
1599
|
+
expect(func.signature).to eq("static int helper(void)")
|
|
1600
|
+
expect(func.body).to eq("{ return 42; }")
|
|
1601
|
+
expect(func.code_block).to eq(content)
|
|
1602
|
+
end
|
|
1603
|
+
|
|
1604
|
+
it "extracts inline function" do
|
|
1605
|
+
content = "inline int fast(void) { return 1; }"
|
|
1606
|
+
success, func, _, _ = try_extract.call(content)
|
|
1607
|
+
|
|
1608
|
+
expect(success).to be true
|
|
1609
|
+
expect(func.name).to eq("fast")
|
|
1610
|
+
expect(func.signature).to eq("inline int fast(void)")
|
|
1611
|
+
expect(func.body).to eq("{ return 1; }")
|
|
1612
|
+
expect(func.code_block).to eq(content)
|
|
1613
|
+
end
|
|
1614
|
+
|
|
1615
|
+
it "extracts function with attributes" do
|
|
1616
|
+
content = "void __attribute__((interrupt)) ISR(void) { handle_interrupt(); }"
|
|
1617
|
+
success, func, _, _ = try_extract.call(content)
|
|
1618
|
+
|
|
1619
|
+
expect(success).to be true
|
|
1620
|
+
expect(func.name).to eq("ISR")
|
|
1621
|
+
expect(func.signature).to eq("void __attribute__((interrupt)) ISR(void)")
|
|
1622
|
+
expect(func.body).to eq("{ handle_interrupt(); }")
|
|
1623
|
+
expect(func.code_block).to eq(content)
|
|
1624
|
+
end
|
|
1625
|
+
|
|
1626
|
+
it "extracts function with whitespace before opening brace" do
|
|
1627
|
+
content = "void foo(void) \n\t { return; }"
|
|
1628
|
+
success, func, _, _ = try_extract.call(content)
|
|
1629
|
+
|
|
1630
|
+
expect(success).to be true
|
|
1631
|
+
expect(func.name).to eq("foo")
|
|
1632
|
+
expect(func.signature).to eq("void foo(void)")
|
|
1633
|
+
expect(func.body).to eq("{ return; }")
|
|
1634
|
+
expect(func.code_block).to eq(content)
|
|
1635
|
+
end
|
|
1636
|
+
|
|
1637
|
+
it "extracts function with array parameters" do
|
|
1638
|
+
content = "void process(int arr[10]) { arr[0] = 1; }"
|
|
1639
|
+
success, func, _, _ = try_extract.call(content)
|
|
1640
|
+
|
|
1641
|
+
expect(success).to be true
|
|
1642
|
+
expect(func.name).to eq("process")
|
|
1643
|
+
expect(func.signature).to eq("void process(int arr[10])")
|
|
1644
|
+
expect(func.body).to eq("{ arr[0] = 1; }")
|
|
1645
|
+
expect(func.code_block).to eq(content)
|
|
1646
|
+
end
|
|
1647
|
+
|
|
1648
|
+
it "extracts function with variadic parameters" do
|
|
1649
|
+
content = "int printf(const char* fmt, ...) { return 0; }"
|
|
1650
|
+
success, func, _, _ = try_extract.call(content)
|
|
1651
|
+
|
|
1652
|
+
expect(success).to be true
|
|
1653
|
+
expect(func.name).to eq("printf")
|
|
1654
|
+
expect(func.signature).to eq("int printf(const char* fmt, ...)")
|
|
1655
|
+
expect(func.body).to eq("{ return 0; }")
|
|
1656
|
+
expect(func.code_block).to eq(content)
|
|
1657
|
+
end
|
|
1658
|
+
|
|
1659
|
+
it "extracts function with const parameters" do
|
|
1660
|
+
content = "void print(const char* str) { puts(str); }"
|
|
1661
|
+
success, func, _, _ = try_extract.call(content)
|
|
1662
|
+
|
|
1663
|
+
expect(success).to be true
|
|
1664
|
+
expect(func.name).to eq("print")
|
|
1665
|
+
expect(func.signature).to eq("void print(const char* str)")
|
|
1666
|
+
expect(func.body).to eq("{ puts(str); }")
|
|
1667
|
+
expect(func.code_block).to eq(content)
|
|
1668
|
+
end
|
|
1669
|
+
|
|
1670
|
+
it "extracts function with volatile parameters" do
|
|
1671
|
+
content = "int read(volatile int* reg) { return *reg; }"
|
|
1672
|
+
success, func, _, _ = try_extract.call(content)
|
|
1673
|
+
|
|
1674
|
+
expect(success).to be true
|
|
1675
|
+
expect(func.name).to eq("read")
|
|
1676
|
+
expect(func.signature).to eq("int read(volatile int* reg)")
|
|
1677
|
+
expect(func.body).to eq("{ return *reg; }")
|
|
1678
|
+
expect(func.code_block).to eq(content)
|
|
1679
|
+
end
|
|
1680
|
+
|
|
1681
|
+
it "extracts function with restrict qualifier" do
|
|
1682
|
+
content = "void copy(char* restrict dst, const char* restrict src) { strcpy(dst, src); }"
|
|
1683
|
+
success, func, _, _ = try_extract.call(content)
|
|
1684
|
+
|
|
1685
|
+
expect(success).to be true
|
|
1686
|
+
expect(func.name).to eq("copy")
|
|
1687
|
+
expect(func.signature).to eq("void copy(char* restrict dst, const char* restrict src)")
|
|
1688
|
+
expect(func.body).to eq("{ strcpy(dst, src); }")
|
|
1689
|
+
expect(func.code_block).to eq(content)
|
|
1690
|
+
end
|
|
1691
|
+
|
|
1692
|
+
it "extracts function with deeply nested braces" do
|
|
1693
|
+
content = "void deep(void) { if (a) { while (b) { for (;;) { break; } } } }"
|
|
1694
|
+
success, func, _, _ = try_extract.call(content)
|
|
1695
|
+
|
|
1696
|
+
expect(success).to be true
|
|
1697
|
+
expect(func.name).to eq("deep")
|
|
1698
|
+
expect(func.body).to eq("{ if (a) { while (b) { for (;;) { break; } } } }")
|
|
1699
|
+
end
|
|
1700
|
+
|
|
1701
|
+
it "extracts function with string literals containing braces" do
|
|
1702
|
+
content = 'void print(void) { printf("{ } braces"); }'
|
|
1703
|
+
success, func, _, _ = try_extract.call(content)
|
|
1704
|
+
|
|
1705
|
+
expect(success).to be true
|
|
1706
|
+
expect(func.name).to eq("print")
|
|
1707
|
+
expect(func.body).to eq('{ printf("{ } braces"); }')
|
|
1708
|
+
end
|
|
1709
|
+
|
|
1710
|
+
it "extracts function with character literals containing braces" do
|
|
1711
|
+
content = "void check(void) { char c = '{'; }"
|
|
1712
|
+
success, func, _, _ = try_extract.call(content)
|
|
1713
|
+
|
|
1714
|
+
expect(success).to be true
|
|
1715
|
+
expect(func.name).to eq("check")
|
|
1716
|
+
expect(func.body).to eq("{ char c = '{'; }")
|
|
1717
|
+
end
|
|
1718
|
+
|
|
1719
|
+
it "extracts function with comments containing braces (block comment replaced with space)" do
|
|
1720
|
+
content = "void func(void) { /* { comment } */ int x = 1; }"
|
|
1721
|
+
success, func, _, _ = try_extract.call(content)
|
|
1722
|
+
|
|
1723
|
+
expect(success).to be true
|
|
1724
|
+
expect(func.name).to eq("func")
|
|
1725
|
+
expect(func.body).to eq("{ int x = 1; }") # space + comment→space + space after comment
|
|
1726
|
+
end
|
|
1727
|
+
|
|
1728
|
+
it "extracts function with line comments containing braces (line comment replaced with space)" do
|
|
1729
|
+
content = "void func(void) { // { comment }\nint x = 1; }"
|
|
1730
|
+
success, func, _, _ = try_extract.call(content)
|
|
1731
|
+
|
|
1732
|
+
expect(success).to be true
|
|
1733
|
+
expect(func.name).to eq("func")
|
|
1734
|
+
expect(func.body).to eq("{ int x = 1; }") # space + comment+newline→space; no leading space on next line
|
|
1735
|
+
end
|
|
1736
|
+
|
|
1737
|
+
it "extracts function with struct initialization" do
|
|
1738
|
+
content = "void init(void) { struct point p = {1, 2}; }"
|
|
1739
|
+
success, func, _, _ = try_extract.call(content)
|
|
1740
|
+
|
|
1741
|
+
expect(success).to be true
|
|
1742
|
+
expect(func.name).to eq("init")
|
|
1743
|
+
expect(func.body).to eq("{ struct point p = {1, 2}; }")
|
|
1744
|
+
end
|
|
1745
|
+
|
|
1746
|
+
it "extracts function with array initialization" do
|
|
1747
|
+
content = "void setup(void) { int arr[] = {1, 2, 3}; }"
|
|
1748
|
+
success, func, _, _ = try_extract.call(content)
|
|
1749
|
+
|
|
1750
|
+
expect(success).to be true
|
|
1751
|
+
expect(func.name).to eq("setup")
|
|
1752
|
+
expect(func.body).to eq("{ int arr[] = {1, 2, 3}; }")
|
|
1753
|
+
end
|
|
1754
|
+
|
|
1755
|
+
it "extracts function with compound literal" do
|
|
1756
|
+
content = "void use(void) { process((struct point){1, 2}); }"
|
|
1757
|
+
success, func, _, _ = try_extract.call(content)
|
|
1758
|
+
|
|
1759
|
+
expect(success).to be true
|
|
1760
|
+
expect(func.name).to eq("use")
|
|
1761
|
+
expect(func.body).to eq("{ process((struct point){1, 2}); }")
|
|
1762
|
+
end
|
|
1763
|
+
|
|
1764
|
+
it "extracts function with designated initializers" do
|
|
1765
|
+
content = "void init(void) { struct point p = {.x = 1, .y = 2}; }"
|
|
1766
|
+
success, func, _, _ = try_extract.call(content)
|
|
1767
|
+
|
|
1768
|
+
expect(success).to be true
|
|
1769
|
+
expect(func.name).to eq("init")
|
|
1770
|
+
expect(func.body).to eq("{ struct point p = {.x = 1, .y = 2}; }")
|
|
1771
|
+
end
|
|
1772
|
+
end
|
|
1773
|
+
|
|
1774
|
+
context "function extraction with various body styles" do
|
|
1775
|
+
it "extracts function with empty body" do
|
|
1776
|
+
content = "void empty(void) {}"
|
|
1777
|
+
success, func, _, _ = try_extract.call(content)
|
|
1778
|
+
|
|
1779
|
+
expect(success).to be true
|
|
1780
|
+
expect(func.name).to eq("empty")
|
|
1781
|
+
expect(func.body).to eq("{}")
|
|
1782
|
+
expect(func.line_count).to eq(1)
|
|
1783
|
+
end
|
|
1784
|
+
|
|
1785
|
+
it "extracts function with only whitespace in body" do
|
|
1786
|
+
content = "void whitespace(void) { \n\t }"
|
|
1787
|
+
success, func, _, _ = try_extract.call(content)
|
|
1788
|
+
|
|
1789
|
+
expect(success).to be true
|
|
1790
|
+
expect(func.name).to eq("whitespace")
|
|
1791
|
+
expect(func.body).to eq("{ \n\t }")
|
|
1792
|
+
end
|
|
1793
|
+
|
|
1794
|
+
it "extracts function with single statement" do
|
|
1795
|
+
content = "void single(void) { return; }"
|
|
1796
|
+
success, func, _, _ = try_extract.call(content)
|
|
1797
|
+
|
|
1798
|
+
expect(success).to be true
|
|
1799
|
+
expect(func.name).to eq("single")
|
|
1800
|
+
expect(func.body).to eq("{ return; }")
|
|
1801
|
+
end
|
|
1802
|
+
|
|
1803
|
+
it "extracts function with multiple statements" do
|
|
1804
|
+
content = "void multi(void) { int a = 1; int b = 2; return; }"
|
|
1805
|
+
success, func, _, _ = try_extract.call(content)
|
|
1806
|
+
|
|
1807
|
+
expect(success).to be true
|
|
1808
|
+
expect(func.name).to eq("multi")
|
|
1809
|
+
expect(func.body).to eq("{ int a = 1; int b = 2; return; }")
|
|
1810
|
+
end
|
|
1811
|
+
|
|
1812
|
+
it "extracts function with switch statement" do
|
|
1813
|
+
content = "void switcher(int x) { switch(x) { case 1: break; default: break; } }"
|
|
1814
|
+
success, func, _, _ = try_extract.call(content)
|
|
1815
|
+
|
|
1816
|
+
expect(success).to be true
|
|
1817
|
+
expect(func.name).to eq("switcher")
|
|
1818
|
+
expect(func.body).to eq("{ switch(x) { case 1: break; default: break; } }")
|
|
1819
|
+
end
|
|
1820
|
+
|
|
1821
|
+
it "extracts function with do-while loop" do
|
|
1822
|
+
content = "void loop(void) { do { work(); } while(condition); }"
|
|
1823
|
+
success, func, _, _ = try_extract.call(content)
|
|
1824
|
+
|
|
1825
|
+
expect(success).to be true
|
|
1826
|
+
expect(func.name).to eq("loop")
|
|
1827
|
+
expect(func.body).to eq("{ do { work(); } while(condition); }")
|
|
1828
|
+
end
|
|
1829
|
+
|
|
1830
|
+
it "extracts function with for loop" do
|
|
1831
|
+
content = "void iterate(void) { for(int i = 0; i < 10; i++) { process(i); } }"
|
|
1832
|
+
success, func, _, _ = try_extract.call(content)
|
|
1833
|
+
|
|
1834
|
+
expect(success).to be true
|
|
1835
|
+
expect(func.name).to eq("iterate")
|
|
1836
|
+
expect(func.body).to eq("{ for(int i = 0; i < 10; i++) { process(i); } }")
|
|
1837
|
+
end
|
|
1838
|
+
|
|
1839
|
+
it "extracts function with while loop" do
|
|
1840
|
+
content = "void wait(void) { while(ready()) { check(); } }"
|
|
1841
|
+
success, func, _, _ = try_extract.call(content)
|
|
1842
|
+
|
|
1843
|
+
expect(success).to be true
|
|
1844
|
+
expect(func.name).to eq("wait")
|
|
1845
|
+
expect(func.body).to eq("{ while(ready()) { check(); } }")
|
|
1846
|
+
end
|
|
1847
|
+
|
|
1848
|
+
it "extracts function with if-else chain" do
|
|
1849
|
+
content = "void decide(int x) { if(x > 0) { pos(); } else if(x < 0) { neg(); } else { zero(); } }"
|
|
1850
|
+
success, func, _, _ = try_extract.call(content)
|
|
1851
|
+
|
|
1852
|
+
expect(success).to be true
|
|
1853
|
+
expect(func.name).to eq("decide")
|
|
1854
|
+
expect(func.body).to eq("{ if(x > 0) { pos(); } else if(x < 0) { neg(); } else { zero(); } }")
|
|
1855
|
+
end
|
|
1856
|
+
|
|
1857
|
+
it "extracts function with ternary operator" do
|
|
1858
|
+
content = "int max(int a, int b) { return a > b ? a : b; }"
|
|
1859
|
+
success, func, _, _ = try_extract.call(content)
|
|
1860
|
+
|
|
1861
|
+
expect(success).to be true
|
|
1862
|
+
expect(func.name).to eq("max")
|
|
1863
|
+
expect(func.body).to eq("{ return a > b ? a : b; }")
|
|
1864
|
+
end
|
|
1865
|
+
|
|
1866
|
+
it "extracts function with goto statement" do
|
|
1867
|
+
content = "void jump(void) { goto label; label: return; }"
|
|
1868
|
+
success, func, _, _ = try_extract.call(content)
|
|
1869
|
+
|
|
1870
|
+
expect(success).to be true
|
|
1871
|
+
expect(func.name).to eq("jump")
|
|
1872
|
+
expect(func.body).to eq("{ goto label; label: return; }")
|
|
1873
|
+
end
|
|
1874
|
+
|
|
1875
|
+
it "extracts function with labeled statement" do
|
|
1876
|
+
content = "void labeled(void) { start: process(); goto start; }"
|
|
1877
|
+
success, func, _, _ = try_extract.call(content)
|
|
1878
|
+
|
|
1879
|
+
expect(success).to be true
|
|
1880
|
+
expect(func.name).to eq("labeled")
|
|
1881
|
+
expect(func.body).to eq("{ start: process(); goto start; }")
|
|
1882
|
+
end
|
|
1883
|
+
end
|
|
1884
|
+
|
|
1885
|
+
context "function extraction with preprocessor directives in body" do
|
|
1886
|
+
it "extracts function with #ifdef in body" do
|
|
1887
|
+
content = "void conditional(void) { #ifdef DEBUG\nlog();\n#endif\n }"
|
|
1888
|
+
success, func, _, _ = try_extract.call(content)
|
|
1889
|
+
|
|
1890
|
+
expect(success).to be true
|
|
1891
|
+
expect(func.name).to eq("conditional")
|
|
1892
|
+
expect(func.body).to eq("{ #ifdef DEBUG\nlog();\n#endif\n }")
|
|
1893
|
+
end
|
|
1894
|
+
|
|
1895
|
+
it "extracts function with #define in body" do
|
|
1896
|
+
content = "void macro(void) { #define LOCAL 1\nint x = LOCAL; }"
|
|
1897
|
+
success, func, _, _ = try_extract.call(content)
|
|
1898
|
+
|
|
1899
|
+
expect(success).to be true
|
|
1900
|
+
expect(func.name).to eq("macro")
|
|
1901
|
+
expect(func.body).to eq("{ #define LOCAL 1\nint x = LOCAL; }")
|
|
1902
|
+
end
|
|
1903
|
+
|
|
1904
|
+
it "extracts function with #include in body" do
|
|
1905
|
+
content = "void include(void) { #include \"local.h\"\nuse_local(); }"
|
|
1906
|
+
success, func, _, _ = try_extract.call(content)
|
|
1907
|
+
|
|
1908
|
+
expect(success).to be true
|
|
1909
|
+
expect(func.name).to eq("include")
|
|
1910
|
+
expect(func.body).to eq("{ #include \"local.h\"\nuse_local(); }")
|
|
1911
|
+
end
|
|
1912
|
+
|
|
1913
|
+
it "extracts function with #pragma in body" do
|
|
1914
|
+
content = "void pragma(void) { #pragma pack(1)\nstruct s { int x; }; }"
|
|
1915
|
+
success, func, _, _ = try_extract.call(content)
|
|
1916
|
+
|
|
1917
|
+
expect(success).to be true
|
|
1918
|
+
expect(func.name).to eq("pragma")
|
|
1919
|
+
expect(func.body).to eq("{ #pragma pack(1)\nstruct s { int x; }; }")
|
|
1920
|
+
end
|
|
1921
|
+
|
|
1922
|
+
it "extracts function with #error in body" do
|
|
1923
|
+
content = "void error(void) { #error \"Not implemented\"\n }"
|
|
1924
|
+
success, func, _, _ = try_extract.call(content)
|
|
1925
|
+
|
|
1926
|
+
expect(success).to be true
|
|
1927
|
+
expect(func.name).to eq("error")
|
|
1928
|
+
expect(func.body).to eq("{ #error \"Not implemented\"\n }")
|
|
1929
|
+
end
|
|
1930
|
+
|
|
1931
|
+
it "extracts function with #warning in body" do
|
|
1932
|
+
content = "void warning(void) { #warning \"Deprecated\"\nold_api(); }"
|
|
1933
|
+
success, func, _, _ = try_extract.call(content)
|
|
1934
|
+
|
|
1935
|
+
expect(success).to be true
|
|
1936
|
+
expect(func.name).to eq("warning")
|
|
1937
|
+
expect(func.body).to eq("{ #warning \"Deprecated\"\nold_api(); }")
|
|
1938
|
+
end
|
|
1939
|
+
|
|
1940
|
+
it "extracts function with multi-line macro in body" do
|
|
1941
|
+
content = "void multiline(void) { #define MACRO(x) \\\n do { \\\n work(x); \\\n } while(0)\nMACRO(1); }"
|
|
1942
|
+
success, func, _, _ = try_extract.call(content)
|
|
1943
|
+
|
|
1944
|
+
expect(success).to be true
|
|
1945
|
+
expect(func.name).to eq("multiline")
|
|
1946
|
+
end
|
|
1947
|
+
end
|
|
1948
|
+
|
|
1949
|
+
context "function extraction with special characters and literals" do
|
|
1950
|
+
it "extracts function with escaped quotes in string" do
|
|
1951
|
+
content = 'void quotes(void) { printf("He said \"hello\""); }'
|
|
1952
|
+
success, func, _, _ = try_extract.call(content)
|
|
1953
|
+
|
|
1954
|
+
expect(success).to be true
|
|
1955
|
+
expect(func.name).to eq("quotes")
|
|
1956
|
+
expect(func.body).to eq('{ printf("He said \"hello\""); }')
|
|
1957
|
+
end
|
|
1958
|
+
|
|
1959
|
+
it "extracts function with escaped backslash in string" do
|
|
1960
|
+
content = 'void backslash(void) { printf("path\\\\file"); }'
|
|
1961
|
+
success, func, _, _ = try_extract.call(content)
|
|
1962
|
+
|
|
1963
|
+
expect(success).to be true
|
|
1964
|
+
expect(func.name).to eq("backslash")
|
|
1965
|
+
expect(func.body).to eq('{ printf("path\\\\file"); }')
|
|
1966
|
+
end
|
|
1967
|
+
|
|
1968
|
+
it "extracts function with newline in string" do
|
|
1969
|
+
content = 'void newline(void) { printf("line1\\nline2"); }'
|
|
1970
|
+
success, func, _, _ = try_extract.call(content)
|
|
1971
|
+
|
|
1972
|
+
expect(success).to be true
|
|
1973
|
+
expect(func.name).to eq("newline")
|
|
1974
|
+
expect(func.body).to eq('{ printf("line1\\nline2"); }')
|
|
1975
|
+
end
|
|
1976
|
+
|
|
1977
|
+
it "extracts function with tab in string" do
|
|
1978
|
+
content = 'void tab(void) { printf("col1\\tcol2"); }'
|
|
1979
|
+
success, func, _, _ = try_extract.call(content)
|
|
1980
|
+
|
|
1981
|
+
expect(success).to be true
|
|
1982
|
+
expect(func.name).to eq("tab")
|
|
1983
|
+
expect(func.body).to eq('{ printf("col1\\tcol2"); }')
|
|
1984
|
+
end
|
|
1985
|
+
|
|
1986
|
+
it "extracts function with hex escape in string" do
|
|
1987
|
+
content = 'void hex(void) { char c = "\\x41"; }'
|
|
1988
|
+
success, func, _, _ = try_extract.call(content)
|
|
1989
|
+
|
|
1990
|
+
expect(success).to be true
|
|
1991
|
+
expect(func.name).to eq("hex")
|
|
1992
|
+
expect(func.body).to eq('{ char c = "\\x41"; }')
|
|
1993
|
+
end
|
|
1994
|
+
|
|
1995
|
+
it "extracts function with octal escape in string" do
|
|
1996
|
+
content = 'void octal(void) { char c = "\\101"; }'
|
|
1997
|
+
success, func, _, _ = try_extract.call(content)
|
|
1998
|
+
|
|
1999
|
+
expect(success).to be true
|
|
2000
|
+
expect(func.name).to eq("octal")
|
|
2001
|
+
expect(func.body).to eq('{ char c = "\\101"; }')
|
|
2002
|
+
end
|
|
2003
|
+
|
|
2004
|
+
it "extracts function with raw string literal (C++11)" do
|
|
2005
|
+
content = 'void raw(void) { const char* s = R"(raw { } string)"; }'
|
|
2006
|
+
success, func, _, _ = try_extract.call(content)
|
|
2007
|
+
|
|
2008
|
+
expect(success).to be true
|
|
2009
|
+
expect(func.name).to eq("raw")
|
|
2010
|
+
expect(func.body).to eq('{ const char* s = R"(raw { } string)"; }')
|
|
2011
|
+
end
|
|
2012
|
+
|
|
2013
|
+
it "extracts function with multi-line string literal" do
|
|
2014
|
+
content = "void multiline(void) { printf(\"line1\"\n\"line2\"); }"
|
|
2015
|
+
success, func, _, _ = try_extract.call(content)
|
|
2016
|
+
|
|
2017
|
+
expect(success).to be true
|
|
2018
|
+
expect(func.name).to eq("multiline")
|
|
2019
|
+
expect(func.body).to eq("{ printf(\"line1\"\n\"line2\"); }")
|
|
2020
|
+
end
|
|
2021
|
+
|
|
2022
|
+
it "extracts function with character literal" do
|
|
2023
|
+
content = "void character(void) { char c = 'A'; }"
|
|
2024
|
+
success, func, _, _ = try_extract.call(content)
|
|
2025
|
+
|
|
2026
|
+
expect(success).to be true
|
|
2027
|
+
expect(func.name).to eq("character")
|
|
2028
|
+
expect(func.body).to eq("{ char c = 'A'; }")
|
|
2029
|
+
end
|
|
2030
|
+
end
|
|
2031
|
+
|
|
2032
|
+
context "extracting multiple functions from same content" do
|
|
2033
|
+
it "extracts two simple functions in sequence" do
|
|
2034
|
+
content = "void first(void) { int a = 1; }\nvoid second(void) { int b = 2; }"
|
|
2035
|
+
filepath = '/path/to/source.c'
|
|
2036
|
+
scanner = StringScanner.new(content)
|
|
2037
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2038
|
+
functions.setup()
|
|
2039
|
+
functions.max_line_length = 1000
|
|
2040
|
+
|
|
2041
|
+
success1, func1 = functions.try_extract_function_definition(scanner, filepath)
|
|
2042
|
+
expect(success1).to be true
|
|
2043
|
+
expect(func1.name).to eq("first")
|
|
2044
|
+
expect(func1.body).to eq("{ int a = 1; }")
|
|
2045
|
+
expect(func1.source_filepath).to eq(filepath)
|
|
2046
|
+
|
|
2047
|
+
success2, func2 = functions.try_extract_function_definition(scanner, filepath)
|
|
2048
|
+
expect(success2).to be true
|
|
2049
|
+
expect(func2.name).to eq("second")
|
|
2050
|
+
expect(func2.body).to eq("{ int b = 2; }")
|
|
2051
|
+
expect(func2.source_filepath).to eq(filepath)
|
|
2052
|
+
|
|
2053
|
+
expect(scanner.eos?).to be true
|
|
2054
|
+
end
|
|
2055
|
+
|
|
2056
|
+
it "extracts three functions with different signatures" do
|
|
2057
|
+
content = <<~CONTENT
|
|
2058
|
+
int add(int a, int b) { return a + b; }
|
|
2059
|
+
|
|
2060
|
+
void print(const char* msg) { printf("%s", msg); }
|
|
2061
|
+
|
|
2062
|
+
static inline bool check(void) { return true; }
|
|
2063
|
+
|
|
2064
|
+
CONTENT
|
|
2065
|
+
filepath = '/path/to/source.c'
|
|
2066
|
+
scanner = StringScanner.new(content)
|
|
2067
|
+
code_text = CExtractorCodeText.new()
|
|
2068
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: code_text })
|
|
2069
|
+
functions.setup()
|
|
2070
|
+
functions.max_line_length = 1000
|
|
2071
|
+
|
|
2072
|
+
success1, func1 = functions.try_extract_function_definition(scanner, filepath)
|
|
2073
|
+
expect(success1).to be true
|
|
2074
|
+
expect(func1.name).to eq("add")
|
|
2075
|
+
expect(func1.signature).to eq("int add(int a, int b)")
|
|
2076
|
+
expect(func1.source_filepath).to eq(filepath)
|
|
2077
|
+
|
|
2078
|
+
success2, func2 = functions.try_extract_function_definition(scanner, filepath)
|
|
2079
|
+
expect(success2).to be true
|
|
2080
|
+
expect(func2.name).to eq("print")
|
|
2081
|
+
expect(func2.signature).to eq("void print(const char* msg)")
|
|
2082
|
+
expect(func2.source_filepath).to eq(filepath)
|
|
2083
|
+
|
|
2084
|
+
success3, func3 = functions.try_extract_function_definition(scanner, filepath)
|
|
2085
|
+
expect(success3).to be true
|
|
2086
|
+
expect(func3.name).to eq("check")
|
|
2087
|
+
expect(func3.signature).to eq("static inline bool check(void)")
|
|
2088
|
+
expect(func3.source_filepath).to eq(filepath)
|
|
2089
|
+
|
|
2090
|
+
code_text.skip_deadspace(scanner)
|
|
2091
|
+
|
|
2092
|
+
expect(scanner.eos?).to be true
|
|
2093
|
+
end
|
|
2094
|
+
|
|
2095
|
+
it "extracts functions separated by comments" do
|
|
2096
|
+
content = <<~CONTENT
|
|
2097
|
+
void first(void) { work(); }
|
|
2098
|
+
// Comment between functions
|
|
2099
|
+
void second(void) { more_work(); }
|
|
2100
|
+
/* Multi-line comment
|
|
2101
|
+
* between functions
|
|
2102
|
+
*/
|
|
2103
|
+
void third(void) { final_work(); }
|
|
2104
|
+
CONTENT
|
|
2105
|
+
filepath = '/path/to/source.c'
|
|
2106
|
+
scanner = StringScanner.new(content)
|
|
2107
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2108
|
+
functions.setup()
|
|
2109
|
+
functions.max_line_length = 1000
|
|
2110
|
+
|
|
2111
|
+
success1, func1 = functions.try_extract_function_definition(scanner, filepath)
|
|
2112
|
+
expect(success1).to be true
|
|
2113
|
+
expect(func1.name).to eq("first")
|
|
2114
|
+
expect(func1.source_filepath).to eq(filepath)
|
|
2115
|
+
|
|
2116
|
+
success2, func2 = functions.try_extract_function_definition(scanner, filepath)
|
|
2117
|
+
expect(success2).to be true
|
|
2118
|
+
expect(func2.name).to eq("second")
|
|
2119
|
+
expect(func2.source_filepath).to eq(filepath)
|
|
2120
|
+
|
|
2121
|
+
success3, func3 = functions.try_extract_function_definition(scanner, filepath)
|
|
2122
|
+
expect(success3).to be true
|
|
2123
|
+
expect(func3.name).to eq("third")
|
|
2124
|
+
expect(func3.source_filepath).to eq(filepath)
|
|
2125
|
+
end
|
|
2126
|
+
end
|
|
2127
|
+
end
|
|
2128
|
+
|
|
2129
|
+
describe "#clean_signature" do
|
|
2130
|
+
let(:functions) do
|
|
2131
|
+
f = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2132
|
+
f.setup()
|
|
2133
|
+
f.max_line_length = 1000
|
|
2134
|
+
f
|
|
2135
|
+
end
|
|
2136
|
+
|
|
2137
|
+
it "removes carriage return and newline" do
|
|
2138
|
+
signature = "void foo(int a,\r\nint b)"
|
|
2139
|
+
result = functions.send(:clean_signature, signature)
|
|
2140
|
+
expect(result).to eq("void foo(int a, int b)")
|
|
2141
|
+
end
|
|
2142
|
+
|
|
2143
|
+
it "removes standalone carriage return" do
|
|
2144
|
+
signature = "void foo(int a,\rint b)"
|
|
2145
|
+
result = functions.send(:clean_signature, signature)
|
|
2146
|
+
expect(result).to eq("void foo(int a, int b)")
|
|
2147
|
+
end
|
|
2148
|
+
|
|
2149
|
+
it "removes standalone newline" do
|
|
2150
|
+
signature = "void foo(int a,\nint b)"
|
|
2151
|
+
result = functions.send(:clean_signature, signature)
|
|
2152
|
+
expect(result).to eq("void foo(int a, int b)")
|
|
2153
|
+
end
|
|
2154
|
+
|
|
2155
|
+
it "removes tabs" do
|
|
2156
|
+
signature = "void\tfoo(int\ta,\tint\tb)"
|
|
2157
|
+
result = functions.send(:clean_signature, signature)
|
|
2158
|
+
expect(result).to eq("void foo(int a, int b)")
|
|
2159
|
+
end
|
|
2160
|
+
|
|
2161
|
+
it "collapses multiple spaces into single space" do
|
|
2162
|
+
signature = "void foo(int a, int b)"
|
|
2163
|
+
result = functions.send(:clean_signature, signature)
|
|
2164
|
+
expect(result).to eq("void foo(int a, int b)")
|
|
2165
|
+
end
|
|
2166
|
+
|
|
2167
|
+
it "removes C-style block comments" do
|
|
2168
|
+
signature = "void /* comment */ foo(int a)"
|
|
2169
|
+
result = functions.send(:clean_signature, signature)
|
|
2170
|
+
expect(result).to eq("void foo(int a)")
|
|
2171
|
+
end
|
|
2172
|
+
|
|
2173
|
+
it "removes multi-line C-style block comments" do
|
|
2174
|
+
signature = "void /* multi\nline\ncomment */ foo(int a)"
|
|
2175
|
+
result = functions.send(:clean_signature, signature)
|
|
2176
|
+
expect(result).to eq("void foo(int a)")
|
|
2177
|
+
end
|
|
2178
|
+
|
|
2179
|
+
it "removes multiple C-style block comments" do
|
|
2180
|
+
signature = "void /* comment1 */ foo /* comment2 */ (int a)"
|
|
2181
|
+
result = functions.send(:clean_signature, signature)
|
|
2182
|
+
expect(result).to eq("void foo (int a)")
|
|
2183
|
+
end
|
|
2184
|
+
|
|
2185
|
+
it "strips leading whitespace" do
|
|
2186
|
+
signature = " void foo(int a)"
|
|
2187
|
+
result = functions.send(:clean_signature, signature)
|
|
2188
|
+
expect(result).to eq("void foo(int a)")
|
|
2189
|
+
end
|
|
2190
|
+
|
|
2191
|
+
it "strips trailing whitespace" do
|
|
2192
|
+
signature = "void foo(int a) "
|
|
2193
|
+
result = functions.send(:clean_signature, signature)
|
|
2194
|
+
expect(result).to eq("void foo(int a)")
|
|
2195
|
+
end
|
|
2196
|
+
|
|
2197
|
+
it "strips leading and trailing whitespace" do
|
|
2198
|
+
signature = " void foo(int a) "
|
|
2199
|
+
result = functions.send(:clean_signature, signature)
|
|
2200
|
+
expect(result).to eq("void foo(int a)")
|
|
2201
|
+
end
|
|
2202
|
+
|
|
2203
|
+
it "handles empty signature" do
|
|
2204
|
+
signature = ""
|
|
2205
|
+
result = functions.send(:clean_signature, signature)
|
|
2206
|
+
expect(result).to eq("")
|
|
2207
|
+
end
|
|
2208
|
+
|
|
2209
|
+
it "handles signature with only whitespace" do
|
|
2210
|
+
signature = " \t\n\r\n "
|
|
2211
|
+
result = functions.send(:clean_signature, signature)
|
|
2212
|
+
expect(result).to eq("")
|
|
2213
|
+
end
|
|
2214
|
+
|
|
2215
|
+
it "handles signature with only comments" do
|
|
2216
|
+
signature = "/* comment */"
|
|
2217
|
+
result = functions.send(:clean_signature, signature)
|
|
2218
|
+
expect(result).to eq("")
|
|
2219
|
+
end
|
|
2220
|
+
|
|
2221
|
+
it "preserves single spaces between tokens" do
|
|
2222
|
+
signature = "void foo(int a, int b)"
|
|
2223
|
+
result = functions.send(:clean_signature, signature)
|
|
2224
|
+
expect(result).to eq("void foo(int a, int b)")
|
|
2225
|
+
end
|
|
2226
|
+
|
|
2227
|
+
it "handles complex signature with all whitespace types" do
|
|
2228
|
+
signature = "void\t\r\nfoo(\nint\ta,\r\nint b\t)"
|
|
2229
|
+
result = functions.send(:clean_signature, signature)
|
|
2230
|
+
expect(result).to eq("void foo( int a, int b )")
|
|
2231
|
+
end
|
|
2232
|
+
|
|
2233
|
+
it "handles signature with nested comments" do
|
|
2234
|
+
signature = "void /* outer /* inner */ outer */ foo(int a)"
|
|
2235
|
+
result = functions.send(:clean_signature, signature)
|
|
2236
|
+
expect(result).to eq("void outer */ foo(int a)")
|
|
2237
|
+
end
|
|
2238
|
+
|
|
2239
|
+
it "handles signature with comment containing special characters" do
|
|
2240
|
+
signature = "void /* comment with {braces} and (parens) */ foo(int a)"
|
|
2241
|
+
result = functions.send(:clean_signature, signature)
|
|
2242
|
+
expect(result).to eq("void foo(int a)")
|
|
2243
|
+
end
|
|
2244
|
+
|
|
2245
|
+
it "handles signature with pointer types" do
|
|
2246
|
+
signature = "void * foo(int * a, char ** b)"
|
|
2247
|
+
result = functions.send(:clean_signature, signature)
|
|
2248
|
+
expect(result).to eq("void * foo(int * a, char ** b)")
|
|
2249
|
+
end
|
|
2250
|
+
|
|
2251
|
+
it "handles signature with const qualifiers" do
|
|
2252
|
+
signature = "const void * foo(const int * a)"
|
|
2253
|
+
result = functions.send(:clean_signature, signature)
|
|
2254
|
+
expect(result).to eq("const void * foo(const int * a)")
|
|
2255
|
+
end
|
|
2256
|
+
|
|
2257
|
+
it "handles signature with function pointer parameters" do
|
|
2258
|
+
signature = "void foo(void (*callback)(int), int * data)"
|
|
2259
|
+
result = functions.send(:clean_signature, signature)
|
|
2260
|
+
expect(result).to eq("void foo(void (*callback)(int), int * data)")
|
|
2261
|
+
end
|
|
2262
|
+
|
|
2263
|
+
it "handles signature with array parameters" do
|
|
2264
|
+
signature = "void foo(int arr[10], char matrix[5][5])"
|
|
2265
|
+
result = functions.send(:clean_signature, signature)
|
|
2266
|
+
expect(result).to eq("void foo(int arr[10], char matrix[5][5])")
|
|
2267
|
+
end
|
|
2268
|
+
|
|
2269
|
+
it "handles signature with variadic parameters" do
|
|
2270
|
+
signature = "int printf(const char * fmt, ...)"
|
|
2271
|
+
result = functions.send(:clean_signature, signature)
|
|
2272
|
+
expect(result).to eq("int printf(const char * fmt, ...)")
|
|
2273
|
+
end
|
|
2274
|
+
|
|
2275
|
+
it "handles signature with struct parameters" do
|
|
2276
|
+
signature = "void foo(struct point p, struct rect * r)"
|
|
2277
|
+
result = functions.send(:clean_signature, signature)
|
|
2278
|
+
expect(result).to eq("void foo(struct point p, struct rect * r)")
|
|
2279
|
+
end
|
|
2280
|
+
|
|
2281
|
+
it "handles signature with enum parameters" do
|
|
2282
|
+
signature = "void foo(enum color c, enum size * s)"
|
|
2283
|
+
result = functions.send(:clean_signature, signature)
|
|
2284
|
+
expect(result).to eq("void foo(enum color c, enum size * s)")
|
|
2285
|
+
end
|
|
2286
|
+
|
|
2287
|
+
it "handles signature with union parameters" do
|
|
2288
|
+
signature = "void foo(union data d, union value * v)"
|
|
2289
|
+
result = functions.send(:clean_signature, signature)
|
|
2290
|
+
expect(result).to eq("void foo(union data d, union value * v)")
|
|
2291
|
+
end
|
|
2292
|
+
|
|
2293
|
+
it "handles signature with typedef'd types" do
|
|
2294
|
+
signature = "void foo(uint32_t value, size_t * size)"
|
|
2295
|
+
result = functions.send(:clean_signature, signature)
|
|
2296
|
+
expect(result).to eq("void foo(uint32_t value, size_t * size)")
|
|
2297
|
+
end
|
|
2298
|
+
|
|
2299
|
+
it "handles signature with storage class specifiers" do
|
|
2300
|
+
signature = "static inline void foo(register int x)"
|
|
2301
|
+
result = functions.send(:clean_signature, signature)
|
|
2302
|
+
expect(result).to eq("static inline void foo(register int x)")
|
|
2303
|
+
end
|
|
2304
|
+
|
|
2305
|
+
it "handles signature with attributes" do
|
|
2306
|
+
signature = "void __attribute__((interrupt)) ISR(void)"
|
|
2307
|
+
result = functions.send(:clean_signature, signature)
|
|
2308
|
+
expect(result).to eq("void __attribute__((interrupt)) ISR(void)")
|
|
2309
|
+
end
|
|
2310
|
+
|
|
2311
|
+
it "handles signature with multiple attributes" do
|
|
2312
|
+
signature = "__attribute__((noreturn)) void __attribute__((cold)) fatal(void)"
|
|
2313
|
+
result = functions.send(:clean_signature, signature)
|
|
2314
|
+
expect(result).to eq("__attribute__((noreturn)) void __attribute__((cold)) fatal(void)")
|
|
2315
|
+
end
|
|
2316
|
+
|
|
2317
|
+
it "handles signature with restrict qualifier" do
|
|
2318
|
+
signature = "void memcpy(void * restrict dst, const void * restrict src)"
|
|
2319
|
+
result = functions.send(:clean_signature, signature)
|
|
2320
|
+
expect(result).to eq("void memcpy(void * restrict dst, const void * restrict src)")
|
|
2321
|
+
end
|
|
2322
|
+
|
|
2323
|
+
it "handles signature with volatile qualifier" do
|
|
2324
|
+
signature = "int read(volatile int * reg)"
|
|
2325
|
+
result = functions.send(:clean_signature, signature)
|
|
2326
|
+
expect(result).to eq("int read(volatile int * reg)")
|
|
2327
|
+
end
|
|
2328
|
+
|
|
2329
|
+
it "handles signature with _Atomic qualifier" do
|
|
2330
|
+
signature = "void atomic_store(_Atomic int * ptr, int value)"
|
|
2331
|
+
result = functions.send(:clean_signature, signature)
|
|
2332
|
+
expect(result).to eq("void atomic_store(_Atomic int * ptr, int value)")
|
|
2333
|
+
end
|
|
2334
|
+
|
|
2335
|
+
it "handles signature with complex return type" do
|
|
2336
|
+
signature = "const struct point * get_point(void)"
|
|
2337
|
+
result = functions.send(:clean_signature, signature)
|
|
2338
|
+
expect(result).to eq("const struct point * get_point(void)")
|
|
2339
|
+
end
|
|
2340
|
+
|
|
2341
|
+
it "handles signature with function pointer return type" do
|
|
2342
|
+
signature = "void (*get_callback(void))(int)"
|
|
2343
|
+
result = functions.send(:clean_signature, signature)
|
|
2344
|
+
expect(result).to eq("void (*get_callback(void))(int)")
|
|
2345
|
+
end
|
|
2346
|
+
|
|
2347
|
+
it "handles real-world complex signature" do
|
|
2348
|
+
signature = <<~SIG.chomp
|
|
2349
|
+
static inline const struct device *
|
|
2350
|
+
/* Get device pointer */
|
|
2351
|
+
get_device(
|
|
2352
|
+
const char * name, // Device name
|
|
2353
|
+
size_t len
|
|
2354
|
+
)
|
|
2355
|
+
SIG
|
|
2356
|
+
result = functions.send(:clean_signature, signature)
|
|
2357
|
+
expect(result).to eq("static inline const struct device * get_device( const char * name, size_t len )")
|
|
2358
|
+
end
|
|
2359
|
+
end
|
|
2360
|
+
|
|
2361
|
+
describe "#clean_declaration" do
|
|
2362
|
+
# NOTE: These test cases do not duplicate `clean_signature()` test coverage.
|
|
2363
|
+
# `clean_declaration()` calls `clean_signature()` internally.
|
|
2364
|
+
let(:functions) do
|
|
2365
|
+
f = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2366
|
+
f.setup()
|
|
2367
|
+
f.max_line_length = 1000
|
|
2368
|
+
f
|
|
2369
|
+
end
|
|
2370
|
+
|
|
2371
|
+
context "whitespace handling before final semicolon" do
|
|
2372
|
+
it "removes single space before semicolon" do
|
|
2373
|
+
declaration = "void foo(void) ;"
|
|
2374
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2375
|
+
expect(result).to eq("void foo(void);")
|
|
2376
|
+
end
|
|
2377
|
+
|
|
2378
|
+
it "removes multiple spaces before semicolon" do
|
|
2379
|
+
declaration = "void foo(void) ;"
|
|
2380
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2381
|
+
expect(result).to eq("void foo(void);")
|
|
2382
|
+
end
|
|
2383
|
+
|
|
2384
|
+
it "removes tab before semicolon" do
|
|
2385
|
+
declaration = "void foo(void)\t;"
|
|
2386
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2387
|
+
expect(result).to eq("void foo(void);")
|
|
2388
|
+
end
|
|
2389
|
+
|
|
2390
|
+
it "removes newline before semicolon" do
|
|
2391
|
+
declaration = "void foo(void)\n;"
|
|
2392
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2393
|
+
expect(result).to eq("void foo(void);")
|
|
2394
|
+
end
|
|
2395
|
+
|
|
2396
|
+
it "removes carriage return and newline before semicolon" do
|
|
2397
|
+
declaration = "void foo(void)\r\n;"
|
|
2398
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2399
|
+
expect(result).to eq("void foo(void);")
|
|
2400
|
+
end
|
|
2401
|
+
|
|
2402
|
+
it "removes mixed whitespace before semicolon" do
|
|
2403
|
+
declaration = "void foo(void) \t\n\r\n ;"
|
|
2404
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2405
|
+
expect(result).to eq("void foo(void);")
|
|
2406
|
+
end
|
|
2407
|
+
|
|
2408
|
+
it "preserves declaration with no space before semicolon" do
|
|
2409
|
+
declaration = "void foo(void);"
|
|
2410
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2411
|
+
expect(result).to eq("void foo(void);")
|
|
2412
|
+
end
|
|
2413
|
+
|
|
2414
|
+
it "handles declaration with parameters and whitespace before semicolon" do
|
|
2415
|
+
declaration = "int add(int a, int b) ;"
|
|
2416
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2417
|
+
expect(result).to eq("int add(int a, int b);")
|
|
2418
|
+
end
|
|
2419
|
+
end
|
|
2420
|
+
|
|
2421
|
+
context "combined cleaning operations" do
|
|
2422
|
+
it "cleans internal whitespace and removes space before semicolon" do
|
|
2423
|
+
declaration = "void foo(int a, int b) ;"
|
|
2424
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2425
|
+
expect(result).to eq("void foo(int a, int b);")
|
|
2426
|
+
end
|
|
2427
|
+
|
|
2428
|
+
it "removes comments and whitespace before semicolon" do
|
|
2429
|
+
declaration = "void foo(void) /* comment */ ;"
|
|
2430
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2431
|
+
expect(result).to eq("void foo(void);")
|
|
2432
|
+
end
|
|
2433
|
+
|
|
2434
|
+
it "handles multiline declaration with whitespace before semicolon" do
|
|
2435
|
+
declaration = "void foo(\n int a,\n int b\n) ;"
|
|
2436
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2437
|
+
expect(result).to eq("void foo( int a, int b );")
|
|
2438
|
+
end
|
|
2439
|
+
|
|
2440
|
+
it "handles declaration with tabs, newlines, and space before semicolon" do
|
|
2441
|
+
declaration = "void\tfoo(\nint\ta\n)\t\n ;"
|
|
2442
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2443
|
+
expect(result).to eq("void foo( int a );")
|
|
2444
|
+
end
|
|
2445
|
+
|
|
2446
|
+
it "handles complex real-world declaration" do
|
|
2447
|
+
declaration = <<~DECL.chomp
|
|
2448
|
+
extern const struct device *
|
|
2449
|
+
/* Get device */
|
|
2450
|
+
get_device(
|
|
2451
|
+
const char * name,
|
|
2452
|
+
size_t len
|
|
2453
|
+
) ;
|
|
2454
|
+
DECL
|
|
2455
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2456
|
+
expect(result).to eq("extern const struct device * get_device( const char * name, size_t len );")
|
|
2457
|
+
end
|
|
2458
|
+
end
|
|
2459
|
+
|
|
2460
|
+
context "edge cases" do
|
|
2461
|
+
it "handles empty declaration" do
|
|
2462
|
+
declaration = ""
|
|
2463
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2464
|
+
expect(result).to eq("")
|
|
2465
|
+
end
|
|
2466
|
+
|
|
2467
|
+
it "preserves semicolons within string literals in parameters" do
|
|
2468
|
+
declaration = 'void log(const char* msg = "error ;") ;'
|
|
2469
|
+
result = functions.send(:clean_declaration, declaration)
|
|
2470
|
+
expect(result).to eq('void log(const char* msg = "error ;");')
|
|
2471
|
+
end
|
|
2472
|
+
end
|
|
2473
|
+
end
|
|
2474
|
+
|
|
2475
|
+
###
|
|
2476
|
+
### try_extract_function_declaration()
|
|
2477
|
+
###
|
|
2478
|
+
|
|
2479
|
+
describe "#try_extract_function_declaration" do
|
|
2480
|
+
let(:try_extract_decl) do
|
|
2481
|
+
->(content) do
|
|
2482
|
+
scanner = StringScanner.new(content)
|
|
2483
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2484
|
+
functions.setup()
|
|
2485
|
+
functions.max_line_length = 1000
|
|
2486
|
+
success, decl = functions.try_extract_function_declaration(scanner)
|
|
2487
|
+
return [success, decl, scanner.pos, scanner.rest]
|
|
2488
|
+
end
|
|
2489
|
+
end
|
|
2490
|
+
|
|
2491
|
+
context "successful extraction returns CFunctionDeclaration struct" do
|
|
2492
|
+
it "extracts simple function declaration" do
|
|
2493
|
+
content = "int foo(void);"
|
|
2494
|
+
success, decl, pos, rest = try_extract_decl.call(content)
|
|
2495
|
+
|
|
2496
|
+
expect(success).to be true
|
|
2497
|
+
expect(decl).to be_a(CExtractorTypes::CFunctionDeclaration)
|
|
2498
|
+
expect(decl.name).to eq("foo")
|
|
2499
|
+
expect(decl.signature).to eq("int foo(void);")
|
|
2500
|
+
expect(decl.decorators).to eq([])
|
|
2501
|
+
expect(decl.signature_stripped).to eq("int foo(void);")
|
|
2502
|
+
expect(pos).to eq(content.length)
|
|
2503
|
+
expect(rest).to eq("")
|
|
2504
|
+
end
|
|
2505
|
+
|
|
2506
|
+
it "extracts void function declaration" do
|
|
2507
|
+
content = "void process(int x, int y);"
|
|
2508
|
+
success, decl, _, _ = try_extract_decl.call(content)
|
|
2509
|
+
|
|
2510
|
+
expect(success).to be true
|
|
2511
|
+
expect(decl.name).to eq("process")
|
|
2512
|
+
expect(decl.signature).to eq("void process(int x, int y);")
|
|
2513
|
+
expect(decl.decorators).to eq([])
|
|
2514
|
+
expect(decl.signature_stripped).to eq("void process(int x, int y);")
|
|
2515
|
+
end
|
|
2516
|
+
|
|
2517
|
+
it "extracts static function declaration and populates decorators" do
|
|
2518
|
+
content = "static int foo(void);"
|
|
2519
|
+
success, decl, _, _ = try_extract_decl.call(content)
|
|
2520
|
+
|
|
2521
|
+
expect(success).to be true
|
|
2522
|
+
expect(decl.name).to eq("foo")
|
|
2523
|
+
expect(decl.decorators).to eq(["static"])
|
|
2524
|
+
expect(decl.signature_stripped).to eq("int foo(void);")
|
|
2525
|
+
end
|
|
2526
|
+
|
|
2527
|
+
it "extracts static inline function declaration" do
|
|
2528
|
+
content = "static inline int foo(void);"
|
|
2529
|
+
success, decl, _, _ = try_extract_decl.call(content)
|
|
2530
|
+
|
|
2531
|
+
expect(success).to be true
|
|
2532
|
+
expect(decl.name).to eq("foo")
|
|
2533
|
+
expect(decl.decorators).to eq(["static", "inline"])
|
|
2534
|
+
expect(decl.signature_stripped).to eq("int foo(void);")
|
|
2535
|
+
end
|
|
2536
|
+
|
|
2537
|
+
it "extracts extern function declaration" do
|
|
2538
|
+
content = "extern void bar(int x);"
|
|
2539
|
+
success, decl, _, _ = try_extract_decl.call(content)
|
|
2540
|
+
|
|
2541
|
+
expect(success).to be true
|
|
2542
|
+
expect(decl.name).to eq("bar")
|
|
2543
|
+
expect(decl.decorators).to eq(["extern"])
|
|
2544
|
+
expect(decl.signature_stripped).to eq("void bar(int x);")
|
|
2545
|
+
end
|
|
2546
|
+
end
|
|
2547
|
+
|
|
2548
|
+
context "failed extraction" do
|
|
2549
|
+
it "returns false for variable declaration" do
|
|
2550
|
+
content = "int x;"
|
|
2551
|
+
success, decl, _, _ = try_extract_decl.call(content)
|
|
2552
|
+
|
|
2553
|
+
expect(success).to be false
|
|
2554
|
+
expect(decl).to be_nil
|
|
2555
|
+
end
|
|
2556
|
+
|
|
2557
|
+
it "returns false for function definition" do
|
|
2558
|
+
content = "void foo(void) { return; }"
|
|
2559
|
+
success, decl, _, _ = try_extract_decl.call(content)
|
|
2560
|
+
|
|
2561
|
+
expect(success).to be false
|
|
2562
|
+
expect(decl).to be_nil
|
|
2563
|
+
end
|
|
2564
|
+
end
|
|
2565
|
+
end
|
|
2566
|
+
|
|
2567
|
+
###
|
|
2568
|
+
### parse_decorators_and_strip() (private)
|
|
2569
|
+
###
|
|
2570
|
+
|
|
2571
|
+
describe "#parse_decorators_and_strip (private method)" do
|
|
2572
|
+
let(:functions) do
|
|
2573
|
+
f = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2574
|
+
f.setup()
|
|
2575
|
+
f
|
|
2576
|
+
end
|
|
2577
|
+
|
|
2578
|
+
it "returns empty decorators and original for simple function" do
|
|
2579
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "int foo(void)", "foo")
|
|
2580
|
+
expect(decorators).to eq([])
|
|
2581
|
+
expect(stripped).to eq("int foo(void)")
|
|
2582
|
+
end
|
|
2583
|
+
|
|
2584
|
+
it "returns empty decorators and original for void function" do
|
|
2585
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "void foo(void)", "foo")
|
|
2586
|
+
expect(decorators).to eq([])
|
|
2587
|
+
expect(stripped).to eq("void foo(void)")
|
|
2588
|
+
end
|
|
2589
|
+
|
|
2590
|
+
it "extracts static decorator" do
|
|
2591
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "static int foo(void)", "foo")
|
|
2592
|
+
expect(decorators).to eq(["static"])
|
|
2593
|
+
expect(stripped).to eq("int foo(void)")
|
|
2594
|
+
end
|
|
2595
|
+
|
|
2596
|
+
it "extracts inline decorator" do
|
|
2597
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "inline int foo(void)", "foo")
|
|
2598
|
+
expect(decorators).to eq(["inline"])
|
|
2599
|
+
expect(stripped).to eq("int foo(void)")
|
|
2600
|
+
end
|
|
2601
|
+
|
|
2602
|
+
it "extracts static inline decorators" do
|
|
2603
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "static inline int foo(void)", "foo")
|
|
2604
|
+
expect(decorators).to eq(["static", "inline"])
|
|
2605
|
+
expect(stripped).to eq("int foo(void)")
|
|
2606
|
+
end
|
|
2607
|
+
|
|
2608
|
+
it "extracts extern decorator" do
|
|
2609
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "extern int foo(void)", "foo")
|
|
2610
|
+
expect(decorators).to eq(["extern"])
|
|
2611
|
+
expect(stripped).to eq("int foo(void)")
|
|
2612
|
+
end
|
|
2613
|
+
|
|
2614
|
+
it "extracts const decorator from return type" do
|
|
2615
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "const int* foo(void)", "foo")
|
|
2616
|
+
expect(decorators).to eq(["const"])
|
|
2617
|
+
expect(stripped).to eq("int* foo(void)")
|
|
2618
|
+
end
|
|
2619
|
+
|
|
2620
|
+
it "separates leading type keyword token and remainder for unsigned int return type" do
|
|
2621
|
+
# The algorithm treats leading TYPE_KEYWORDS as the split point; "unsigned" becomes a decorator
|
|
2622
|
+
# and "int" becomes the start of the return type
|
|
2623
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "unsigned int foo(void)", "foo")
|
|
2624
|
+
expect(decorators).to eq(["unsigned"])
|
|
2625
|
+
expect(stripped).to eq("int foo(void)")
|
|
2626
|
+
end
|
|
2627
|
+
|
|
2628
|
+
it "separates leading struct keyword token and remainder for struct return type" do
|
|
2629
|
+
# Similarly, "struct" is a TYPE_KEYWORD and becomes the split point
|
|
2630
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "struct Point* foo(void)", "foo")
|
|
2631
|
+
expect(decorators).to eq(["struct"])
|
|
2632
|
+
expect(stripped).to eq("Point* foo(void)")
|
|
2633
|
+
end
|
|
2634
|
+
|
|
2635
|
+
it "separates leading long keyword token and remainder for long return type" do
|
|
2636
|
+
# Similarly, "long" is a TYPE_KEYWORD and becomes the split point
|
|
2637
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "long int foo(void)", "foo")
|
|
2638
|
+
expect(decorators).to eq(["long"])
|
|
2639
|
+
expect(stripped).to eq("int foo(void)")
|
|
2640
|
+
end
|
|
2641
|
+
|
|
2642
|
+
it "returns empty decorators and original signature when name is nil" do
|
|
2643
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "int foo(void)", nil)
|
|
2644
|
+
expect(decorators).to eq([])
|
|
2645
|
+
expect(stripped).to eq("int foo(void)")
|
|
2646
|
+
end
|
|
2647
|
+
|
|
2648
|
+
it "returns empty decorators and original signature when name not found" do
|
|
2649
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "int foo(void)", "bar")
|
|
2650
|
+
expect(decorators).to eq([])
|
|
2651
|
+
expect(stripped).to eq("int foo(void)")
|
|
2652
|
+
end
|
|
2653
|
+
|
|
2654
|
+
it "returns empty decorators and original signature for single-token prefix" do
|
|
2655
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "int foo(void)", "foo")
|
|
2656
|
+
expect(decorators).to eq([])
|
|
2657
|
+
expect(stripped).to eq("int foo(void)")
|
|
2658
|
+
end
|
|
2659
|
+
|
|
2660
|
+
it "handles __inline decorator" do
|
|
2661
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "__inline int foo(void)", "foo")
|
|
2662
|
+
expect(decorators).to eq(["__inline"])
|
|
2663
|
+
expect(stripped).to eq("int foo(void)")
|
|
2664
|
+
end
|
|
2665
|
+
|
|
2666
|
+
it "handles static with pointer return type" do
|
|
2667
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "static char* foo(void)", "foo")
|
|
2668
|
+
expect(decorators).to eq(["static"])
|
|
2669
|
+
expect(stripped).to eq("char* foo(void)")
|
|
2670
|
+
end
|
|
2671
|
+
|
|
2672
|
+
it "handles static const pointer return -- both static and const are decorators" do
|
|
2673
|
+
# const is in MODIFIER_KEYWORDS, so algorithm treats it as decorator alongside static
|
|
2674
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "static const char* foo(void)", "foo")
|
|
2675
|
+
expect(decorators).to eq(["static", "const"])
|
|
2676
|
+
expect(stripped).to eq("char* foo(void)")
|
|
2677
|
+
end
|
|
2678
|
+
|
|
2679
|
+
it "handles function with parameters that include type keywords" do
|
|
2680
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "static int foo(unsigned int x)", "foo")
|
|
2681
|
+
expect(decorators).to eq(["static"])
|
|
2682
|
+
expect(stripped).to eq("int foo(unsigned int x)")
|
|
2683
|
+
end
|
|
2684
|
+
|
|
2685
|
+
it "handles extern with struct return type" do
|
|
2686
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "extern struct Node* foo(void)", "foo")
|
|
2687
|
+
expect(decorators).to eq(["extern"])
|
|
2688
|
+
expect(stripped).to eq("struct Node* foo(void)")
|
|
2689
|
+
end
|
|
2690
|
+
|
|
2691
|
+
it "recognizes __forceinline as a private decorator" do
|
|
2692
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "__forceinline void foo(void)", "foo")
|
|
2693
|
+
expect(decorators).to eq(["__forceinline"])
|
|
2694
|
+
expect(stripped).to eq("void foo(void)")
|
|
2695
|
+
end
|
|
2696
|
+
|
|
2697
|
+
it "recognizes static __forceinline combination" do
|
|
2698
|
+
decorators, stripped = functions.send(:parse_decorators_and_strip, "static __forceinline int foo(void)", "foo")
|
|
2699
|
+
expect(decorators).to eq(["static", "__forceinline"])
|
|
2700
|
+
expect(stripped).to eq("int foo(void)")
|
|
2701
|
+
end
|
|
2702
|
+
end
|
|
2703
|
+
|
|
2704
|
+
###
|
|
2705
|
+
### try_extract_function_definition() -- decorator/signature_stripped fields
|
|
2706
|
+
###
|
|
2707
|
+
|
|
2708
|
+
describe "#try_extract_function_definition decorator fields" do
|
|
2709
|
+
let(:try_extract) do
|
|
2710
|
+
->(content, filepath='/path/to/source.c') do
|
|
2711
|
+
scanner = StringScanner.new(content)
|
|
2712
|
+
functions = CExtractorFunctions.new({ c_extractor_code_text: CExtractorCodeText.new() })
|
|
2713
|
+
functions.setup()
|
|
2714
|
+
functions.max_line_length = 1000
|
|
2715
|
+
success, func = functions.try_extract_function_definition( scanner, filepath )
|
|
2716
|
+
return [success, func]
|
|
2717
|
+
end
|
|
2718
|
+
end
|
|
2719
|
+
|
|
2720
|
+
it "sets empty decorators and signature_stripped matching signature for plain function" do
|
|
2721
|
+
success, func = try_extract.call("void foo(void) { }")
|
|
2722
|
+
expect(success).to be true
|
|
2723
|
+
expect(func.decorators).to eq([])
|
|
2724
|
+
expect(func.signature_stripped).to eq("void foo(void)")
|
|
2725
|
+
end
|
|
2726
|
+
|
|
2727
|
+
it "populates decorators and signature_stripped for static function" do
|
|
2728
|
+
success, func = try_extract.call("static void foo(void) { }")
|
|
2729
|
+
expect(success).to be true
|
|
2730
|
+
expect(func.decorators).to eq(["static"])
|
|
2731
|
+
expect(func.signature_stripped).to eq("void foo(void)")
|
|
2732
|
+
end
|
|
2733
|
+
|
|
2734
|
+
it "populates decorators and signature_stripped for static inline function" do
|
|
2735
|
+
success, func = try_extract.call("static inline int bar(int x) { return x; }")
|
|
2736
|
+
expect(success).to be true
|
|
2737
|
+
expect(func.decorators).to eq(["static", "inline"])
|
|
2738
|
+
expect(func.signature_stripped).to eq("int bar(int x)")
|
|
2739
|
+
end
|
|
2740
|
+
end
|
|
2741
|
+
|
|
2742
|
+
end
|