ceedling 0.25.0 → 0.27.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.
Files changed (434) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/assets/project_as_gem.yml +13 -0
  4. data/assets/project_with_guts.yml +13 -0
  5. data/bin/ceedling +91 -67
  6. data/docs/CeedlingPacket.md +61 -23
  7. data/docs/CeedlingPacket.odt +0 -0
  8. data/docs/CeedlingPacket.pdf +0 -0
  9. data/docs/ThrowTheSwitchCodingStandard.md +207 -0
  10. data/examples/temp_sensor/test/TestTemperatureCalculator.c +4 -1
  11. data/lib/ceedling/configurator.rb +14 -1
  12. data/lib/ceedling/configurator_builder.rb +2 -1
  13. data/lib/ceedling/configurator_validator.rb +12 -3
  14. data/lib/ceedling/constants.rb +3 -1
  15. data/lib/ceedling/defaults.rb +12 -1
  16. data/lib/ceedling/file_finder.rb +3 -0
  17. data/lib/ceedling/file_path_utils.rb +1 -1
  18. data/lib/ceedling/file_wrapper.rb +4 -4
  19. data/lib/ceedling/generator.rb +12 -3
  20. data/lib/ceedling/preprocessinator_helper.rb +5 -5
  21. data/lib/ceedling/preprocessinator_includes_handler.rb +10 -1
  22. data/lib/ceedling/project_config_manager.rb +1 -2
  23. data/lib/ceedling/project_file_loader.rb +27 -9
  24. data/lib/ceedling/rakefile.rb +6 -6
  25. data/lib/ceedling/release_invoker.rb +21 -6
  26. data/lib/ceedling/rules_release.rake +9 -5
  27. data/lib/ceedling/rules_tests.rake +6 -1
  28. data/lib/ceedling/setupinator.rb +1 -0
  29. data/lib/ceedling/tasks_base.rake +3 -0
  30. data/lib/ceedling/tasks_filesystem.rake +10 -7
  31. data/lib/ceedling/tasks_release.rake +3 -1
  32. data/lib/ceedling/test_includes_extractor.rb +16 -12
  33. data/lib/ceedling/test_invoker.rb +40 -0
  34. data/lib/ceedling/version.rb +3 -3
  35. data/lib/ceedling/version.rb.erb +1 -1
  36. data/plugins/command_hooks/lib/command_hooks.rb +1 -1
  37. data/plugins/fake_function_framework/examples/fff_example/src/bar.h +1 -0
  38. data/plugins/fake_function_framework/examples/fff_example/src/event_processor.c +1 -0
  39. data/plugins/fake_function_framework/lib/fff_mock_generator.rb +4 -0
  40. data/plugins/fake_function_framework/spec/{fff_mock_generator_spec.rb → fff_mock_header_generator_spec.rb} +34 -194
  41. data/plugins/fake_function_framework/spec/fff_mock_source_generator_spec.rb +149 -0
  42. data/plugins/fake_function_framework/spec/header_generator.rb +51 -0
  43. data/plugins/junit_tests_report/lib/junit_tests_report.rb +115 -0
  44. data/plugins/subprojects/README.md +63 -0
  45. data/plugins/subprojects/config/defaults.yml +33 -0
  46. data/plugins/subprojects/lib/subprojects.rb +92 -0
  47. data/plugins/subprojects/subprojects.rake +78 -0
  48. data/spec/preprocessinator_includes_handler_spec.rb +15 -5
  49. data/spec/spec_helper.rb +2 -2
  50. data/spec/spec_system_helper.rb +49 -1
  51. data/spec/system/deployment_spec.rb +29 -0
  52. data/vendor/c_exception/README.md +8 -2
  53. data/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
  54. data/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
  55. data/vendor/c_exception/vendor/unity/README.md +19 -10
  56. data/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
  57. data/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
  58. data/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
  59. data/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
  60. data/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
  61. data/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
  62. data/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
  63. data/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
  64. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
  65. data/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
  66. data/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  67. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  68. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  69. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  70. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  71. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  72. data/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
  73. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  74. data/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  75. data/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
  76. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
  77. data/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  78. data/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
  79. data/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
  80. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
  81. data/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  82. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  83. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  84. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  85. data/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  86. data/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  87. data/vendor/c_exception/vendor/unity/src/unity.c +396 -330
  88. data/vendor/c_exception/vendor/unity/src/unity.h +50 -4
  89. data/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
  90. data/vendor/c_exception/vendor/unity/test/Makefile +17 -17
  91. data/vendor/c_exception/vendor/unity/test/rakefile +63 -3
  92. data/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
  93. data/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  94. data/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
  95. data/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
  96. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  97. data/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  98. data/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  99. data/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
  100. data/vendor/cmock/README.md +10 -1
  101. data/vendor/cmock/config/test_environment.rb +7 -7
  102. data/vendor/cmock/docs/CMock_Summary.md +325 -128
  103. data/vendor/cmock/docs/ThrowTheSwitchCodingStandard.md +207 -0
  104. data/vendor/cmock/examples/make_example/Makefile +2 -2
  105. data/vendor/cmock/examples/temp_sensor/gcc.yml +5 -4
  106. data/vendor/cmock/examples/temp_sensor/iar_v4.yml +5 -4
  107. data/vendor/cmock/examples/temp_sensor/iar_v5.yml +5 -4
  108. data/vendor/cmock/examples/temp_sensor/rakefile.rb +11 -1
  109. data/vendor/cmock/examples/temp_sensor/rakefile_helper.rb +12 -10
  110. data/vendor/cmock/lib/cmock.rb +0 -3
  111. data/vendor/cmock/lib/cmock_generator_plugin_callback.rb +6 -2
  112. data/vendor/cmock/lib/cmock_generator_plugin_return_thru_ptr.rb +2 -1
  113. data/vendor/cmock/lib/cmock_header_parser.rb +5 -6
  114. data/vendor/cmock/release/version.info +1 -1
  115. data/vendor/cmock/scripts/create_makefile.rb +4 -2
  116. data/vendor/cmock/scripts/test_summary.rb +17 -9
  117. data/vendor/cmock/src/cmock.c +1 -0
  118. data/vendor/cmock/src/cmock.h +1 -1
  119. data/vendor/cmock/src/cmock_internals.h +14 -1
  120. data/vendor/cmock/test/c/TestCMockC.yml +4 -4
  121. data/vendor/cmock/test/c/TestCMockCDynamic.yml +4 -4
  122. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_FLASH.mac +0 -0
  123. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_RAM.mac +0 -0
  124. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/SAM7_SIM.mac +0 -0
  125. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_FLASH.xcl +0 -0
  126. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/at91SAM7X256_RAM.xcl +0 -0
  127. data/vendor/cmock/{iar → test/iar}/iar_v4/Resource/ioat91sam7x256.ddf +0 -0
  128. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.dep +0 -0
  129. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewd +0 -0
  130. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.ewp +0 -0
  131. data/vendor/cmock/{iar → test/iar}/iar_v4/cmock_demo.eww +0 -0
  132. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X-EK.h +0 -0
  133. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.inc +0 -0
  134. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.rdf +0 -0
  135. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256.tcl +0 -0
  136. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/AT91SAM7X256_inc.h +0 -0
  137. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/ioat91sam7x256.h +0 -0
  138. data/vendor/cmock/{iar → test/iar}/iar_v4/incIAR/lib_AT91SAM7X256.h +0 -0
  139. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.cspy.bat +0 -0
  140. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dbgdt +0 -0
  141. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.dni +0 -0
  142. data/vendor/cmock/{iar → test/iar}/iar_v4/settings/cmock_demo.wsdt +0 -0
  143. data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup.s79 +0 -0
  144. data/vendor/cmock/{iar → test/iar}/iar_v4/srcIAR/Cstartup_SAM7.c +0 -0
  145. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_FLASH.mac +0 -0
  146. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_RAM.mac +0 -0
  147. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/SAM7_SIM.mac +0 -0
  148. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_FLASH.icf +0 -0
  149. data/vendor/cmock/{iar → test/iar}/iar_v5/Resource/at91SAM7X256_RAM.icf +0 -0
  150. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.dep +0 -0
  151. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewd +0 -0
  152. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.ewp +0 -0
  153. data/vendor/cmock/{iar → test/iar}/iar_v5/cmock_demo.eww +0 -0
  154. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X-EK.h +0 -0
  155. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/AT91SAM7X256_inc.h +0 -0
  156. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/lib_AT91SAM7X256.h +0 -0
  157. data/vendor/cmock/{iar → test/iar}/iar_v5/incIAR/project.h +0 -0
  158. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.cspy.bat +0 -0
  159. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dbgdt +0 -0
  160. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.dni +0 -0
  161. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X.wsdt +0 -0
  162. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/BasicInterrupt_SAM7X_FLASH_Debug.jlink +0 -0
  163. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.cspy.bat +0 -0
  164. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dbgdt +0 -0
  165. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.dni +0 -0
  166. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo.wsdt +0 -0
  167. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_Binary.jlink +0 -0
  168. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_FLASH_Debug.jlink +0 -0
  169. data/vendor/cmock/{iar → test/iar}/iar_v5/settings/cmock_demo_RAM_Debug.jlink +0 -0
  170. data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup.s +0 -0
  171. data/vendor/cmock/{iar → test/iar}/iar_v5/srcIAR/Cstartup_SAM7.c +0 -0
  172. data/vendor/cmock/{Rakefile → test/rakefile} +9 -9
  173. data/vendor/cmock/{rakefile_helper.rb → test/rakefile_helper.rb} +13 -13
  174. data/vendor/cmock/test/system/test_compilation/config.yml +4 -4
  175. data/vendor/cmock/test/system/test_interactions/parsing_challenges.yml +2 -0
  176. data/vendor/cmock/{targets → test/targets}/clang_strict.yml +11 -11
  177. data/vendor/cmock/{targets → test/targets}/gcc.yml +9 -9
  178. data/vendor/cmock/{targets → test/targets}/gcc_64.yml +9 -9
  179. data/vendor/cmock/{targets → test/targets}/gcc_tiny.yml +9 -9
  180. data/vendor/cmock/{targets → test/targets}/iar_arm_v4.yml +9 -9
  181. data/vendor/cmock/{targets → test/targets}/iar_arm_v5.yml +10 -10
  182. data/vendor/cmock/test/test_helper.rb +4 -8
  183. data/vendor/cmock/test/unit/cmock_config_test.rb +1 -1
  184. data/vendor/cmock/test/unit/cmock_file_writer_test.rb +1 -1
  185. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +1 -1
  186. data/vendor/cmock/test/unit/cmock_generator_plugin_array_test.rb +1 -1
  187. data/vendor/cmock/test/unit/cmock_generator_plugin_callback_test.rb +3 -1
  188. data/vendor/cmock/test/unit/cmock_generator_plugin_cexception_test.rb +1 -1
  189. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_a_test.rb +1 -1
  190. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_any_args_test.rb +1 -1
  191. data/vendor/cmock/test/unit/cmock_generator_plugin_expect_b_test.rb +1 -1
  192. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_arg_test.rb +1 -1
  193. data/vendor/cmock/test/unit/cmock_generator_plugin_ignore_test.rb +1 -1
  194. data/vendor/cmock/test/unit/cmock_generator_plugin_return_thru_ptr_test.rb +1 -1
  195. data/vendor/cmock/test/unit/cmock_generator_utils_test.rb +1 -1
  196. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +15 -2
  197. data/vendor/cmock/test/unit/cmock_plugin_manager_test.rb +6 -10
  198. data/vendor/cmock/test/unit/cmock_unityhelper_parser_test.rb +1 -1
  199. data/vendor/cmock/vendor/c_exception/README.md +8 -2
  200. data/vendor/cmock/vendor/c_exception/docs/{readme.txt → CException.md} +133 -102
  201. data/vendor/cmock/vendor/c_exception/docs/ThrowTheSwitchCodingStandard.md +207 -0
  202. data/vendor/cmock/vendor/c_exception/vendor/unity/README.md +19 -10
  203. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_prompt.rb +67 -64
  204. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/colour_reporter.rb +20 -20
  205. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_module.rb +149 -142
  206. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/generate_test_runner.rb +234 -232
  207. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parse_output.rb +220 -0
  208. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/stylize_as_junit.rb +108 -120
  209. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/test_file_filter.rb +11 -9
  210. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/type_sanitizer.rb +1 -3
  211. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.py +6 -2
  212. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/unity_test_summary.rb +45 -57
  213. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  214. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  215. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  216. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  217. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  218. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  219. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/makefile +22 -17
  220. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  221. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  222. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_2/makefile +16 -17
  223. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile.rb +15 -15
  224. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  225. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/example_3/readme.txt +4 -10
  226. data/vendor/cmock/vendor/c_exception/vendor/unity/examples/unity_config.h +14 -26
  227. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile.rb +12 -12
  228. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  229. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  230. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  231. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  232. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  233. data/vendor/cmock/vendor/c_exception/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  234. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.c +396 -330
  235. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity.h +50 -4
  236. data/vendor/cmock/vendor/c_exception/vendor/unity/src/unity_internals.h +119 -84
  237. data/vendor/cmock/vendor/c_exception/vendor/unity/test/Makefile +17 -17
  238. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile +63 -3
  239. data/vendor/cmock/vendor/c_exception/vendor/unity/test/rakefile_helper.rb +108 -105
  240. data/vendor/cmock/vendor/c_exception/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  241. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_file.yml +0 -6
  242. data/vendor/cmock/vendor/c_exception/vendor/unity/test/targets/clang_strict.yml +1 -9
  243. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  244. data/vendor/cmock/vendor/c_exception/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  245. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  246. data/vendor/cmock/vendor/c_exception/vendor/unity/test/tests/testunity.c +1338 -151
  247. data/vendor/cmock/vendor/unity/README.md +19 -10
  248. data/vendor/cmock/vendor/unity/auto/colour_prompt.rb +67 -64
  249. data/vendor/cmock/vendor/unity/auto/colour_reporter.rb +20 -20
  250. data/vendor/cmock/vendor/unity/auto/generate_module.rb +149 -142
  251. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +234 -232
  252. data/vendor/cmock/vendor/unity/auto/parse_output.rb +220 -0
  253. data/vendor/cmock/vendor/unity/auto/stylize_as_junit.rb +108 -120
  254. data/vendor/cmock/vendor/unity/auto/test_file_filter.rb +11 -9
  255. data/vendor/cmock/vendor/unity/auto/type_sanitizer.rb +1 -3
  256. data/vendor/cmock/vendor/unity/auto/unity_test_summary.py +6 -2
  257. data/vendor/cmock/vendor/unity/auto/unity_test_summary.rb +45 -57
  258. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  259. data/vendor/cmock/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  260. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  261. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  262. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  263. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  264. data/vendor/cmock/vendor/unity/examples/example_1/makefile +22 -17
  265. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  266. data/vendor/cmock/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  267. data/vendor/cmock/vendor/unity/examples/example_2/makefile +16 -17
  268. data/vendor/cmock/vendor/unity/examples/example_3/rakefile.rb +15 -15
  269. data/vendor/cmock/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  270. data/vendor/cmock/vendor/unity/examples/example_3/readme.txt +4 -10
  271. data/vendor/cmock/vendor/unity/examples/unity_config.h +14 -26
  272. data/vendor/cmock/vendor/unity/extras/fixture/rakefile.rb +12 -12
  273. data/vendor/cmock/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  274. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  275. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  276. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  277. data/vendor/cmock/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  278. data/vendor/cmock/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  279. data/vendor/cmock/vendor/unity/release/version.info +1 -1
  280. data/vendor/cmock/vendor/unity/src/unity.c +396 -330
  281. data/vendor/cmock/vendor/unity/src/unity.h +50 -4
  282. data/vendor/cmock/vendor/unity/src/unity_internals.h +119 -84
  283. data/vendor/cmock/vendor/unity/test/Makefile +17 -17
  284. data/vendor/cmock/vendor/unity/test/rakefile +63 -3
  285. data/vendor/cmock/vendor/unity/test/rakefile_helper.rb +108 -105
  286. data/vendor/cmock/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  287. data/vendor/cmock/vendor/unity/test/targets/clang_file.yml +0 -6
  288. data/vendor/cmock/vendor/unity/test/targets/clang_strict.yml +1 -9
  289. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  290. data/vendor/cmock/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  291. data/vendor/cmock/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  292. data/vendor/cmock/vendor/unity/test/tests/testunity.c +1338 -151
  293. data/vendor/deep_merge/Rakefile +1 -1
  294. data/vendor/unity/README.md +19 -10
  295. data/vendor/unity/auto/colour_prompt.rb +67 -64
  296. data/vendor/unity/auto/colour_reporter.rb +20 -20
  297. data/vendor/unity/auto/generate_module.rb +149 -142
  298. data/vendor/unity/auto/generate_test_runner.rb +234 -232
  299. data/vendor/unity/auto/parse_output.rb +220 -0
  300. data/vendor/unity/auto/stylize_as_junit.rb +108 -120
  301. data/vendor/unity/auto/test_file_filter.rb +11 -9
  302. data/vendor/unity/auto/type_sanitizer.rb +1 -3
  303. data/vendor/unity/auto/unity_test_summary.py +6 -2
  304. data/vendor/unity/auto/unity_test_summary.rb +45 -57
  305. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +207 -0
  306. data/vendor/unity/docs/UnityAssertionsCheatSheetSuitableforPrintingandPossiblyFraming.pdf +0 -0
  307. data/vendor/unity/docs/UnityAssertionsReference.md +716 -0
  308. data/vendor/unity/docs/UnityConfigurationGuide.md +398 -0
  309. data/vendor/unity/docs/UnityGettingStartedGuide.md +191 -0
  310. data/vendor/unity/docs/UnityHelperScriptsGuide.md +242 -0
  311. data/vendor/unity/examples/example_1/makefile +22 -17
  312. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode2_Runner.c +1 -1
  313. data/vendor/unity/examples/example_1/test/test_runners/TestProductionCode_Runner.c +1 -1
  314. data/vendor/unity/examples/example_2/makefile +16 -17
  315. data/vendor/unity/examples/example_3/rakefile.rb +15 -15
  316. data/vendor/unity/examples/example_3/rakefile_helper.rb +93 -100
  317. data/vendor/unity/examples/example_3/readme.txt +4 -10
  318. data/vendor/unity/examples/unity_config.h +14 -26
  319. data/vendor/unity/extras/fixture/rakefile.rb +12 -12
  320. data/vendor/unity/extras/fixture/rakefile_helper.rb +87 -88
  321. data/vendor/unity/extras/fixture/src/unity_fixture.c +15 -8
  322. data/vendor/unity/extras/fixture/src/unity_fixture.h +6 -1
  323. data/vendor/unity/extras/fixture/src/unity_fixture_internals.h +3 -0
  324. data/vendor/unity/extras/fixture/src/unity_fixture_malloc_overrides.h +1 -0
  325. data/vendor/unity/extras/fixture/test/unity_fixture_Test.c +1 -1
  326. data/vendor/unity/release/version.info +1 -1
  327. data/vendor/unity/src/unity.c +396 -330
  328. data/vendor/unity/src/unity.h +50 -4
  329. data/vendor/unity/src/unity_internals.h +119 -84
  330. data/vendor/unity/test/Makefile +17 -17
  331. data/vendor/unity/test/rakefile +63 -3
  332. data/vendor/unity/test/rakefile_helper.rb +108 -105
  333. data/vendor/unity/test/spec/generate_module_existing_file_spec.rb +158 -0
  334. data/vendor/unity/test/targets/clang_file.yml +0 -6
  335. data/vendor/unity/test/targets/clang_strict.yml +1 -9
  336. data/vendor/unity/test/testdata/testRunnerGeneratorSmall.c +2 -0
  337. data/vendor/unity/test/testdata/testRunnerGeneratorWithMocks.c +2 -2
  338. data/vendor/unity/test/tests/test_generate_test_runner.rb +5 -5
  339. data/vendor/unity/test/tests/testunity.c +1338 -151
  340. metadata +102 -157
  341. data/test_graveyard/integration/paths.yml +0 -17
  342. data/test_graveyard/integration/paths_test.rb +0 -80
  343. data/test_graveyard/integration/rake_rules_aux_dependencies_test.rb +0 -75
  344. data/test_graveyard/integration/rake_rules_cmock_test.rb +0 -74
  345. data/test_graveyard/integration/rake_rules_preprocess_test.rb +0 -178
  346. data/test_graveyard/integration/rake_rules_test.rb +0 -268
  347. data/test_graveyard/integration/rake_tasks_test.rb +0 -103
  348. data/test_graveyard/integration_test_helper.rb +0 -34
  349. data/test_graveyard/rakefile_rules.rb +0 -10
  350. data/test_graveyard/rakefile_rules_aux_dependencies.rb +0 -10
  351. data/test_graveyard/rakefile_rules_cmock.rb +0 -10
  352. data/test_graveyard/rakefile_rules_preprocess.rb +0 -10
  353. data/test_graveyard/rakefile_tasks.rb +0 -10
  354. data/test_graveyard/system/file_system_dependencies.yml +0 -20
  355. data/test_graveyard/system/file_system_kitchen_sink.yml +0 -20
  356. data/test_graveyard/system/file_system_mocks.yml +0 -20
  357. data/test_graveyard/system/file_system_preprocess.yml +0 -20
  358. data/test_graveyard/system/file_system_simple.yml +0 -20
  359. data/test_graveyard/system/file_system_test.rb +0 -78
  360. data/test_graveyard/system/mocks/include/a_file.h +0 -2
  361. data/test_graveyard/system/mocks/include/other_stuff.h +0 -2
  362. data/test_graveyard/system/mocks/include/stuff.h +0 -3
  363. data/test_graveyard/system/mocks/source/a_file.c +0 -9
  364. data/test_graveyard/system/mocks/test/test_a_file.c +0 -41
  365. data/test_graveyard/system/mocks/test/test_no_file.c +0 -14
  366. data/test_graveyard/system/project_mocks.yml +0 -43
  367. data/test_graveyard/system/project_mocks_test.rb +0 -38
  368. data/test_graveyard/system/project_simple.yml +0 -36
  369. data/test_graveyard/system/project_simple_test.rb +0 -39
  370. data/test_graveyard/system/rule_mocks_test.rb +0 -44
  371. data/test_graveyard/system/rule_runners_test.rb +0 -44
  372. data/test_graveyard/system/simple/include/other_stuff.h +0 -2
  373. data/test_graveyard/system/simple/include/stuff.h +0 -3
  374. data/test_graveyard/system/simple/source/other_stuff.c +0 -6
  375. data/test_graveyard/system/simple/source/stuff.c +0 -7
  376. data/test_graveyard/system/simple/test/test_other_stuff.c +0 -30
  377. data/test_graveyard/system/simple/test/test_stuff.c +0 -51
  378. data/test_graveyard/system_test_helper.rb +0 -73
  379. data/test_graveyard/test_helper.rb +0 -93
  380. data/test_graveyard/unit/busted/configurator_builder_test.rb +0 -569
  381. data/test_graveyard/unit/busted/configurator_helper_test.rb +0 -234
  382. data/test_graveyard/unit/busted/configurator_test.rb +0 -232
  383. data/test_graveyard/unit/busted/configurator_validator_test.rb +0 -169
  384. data/test_graveyard/unit/busted/deep_merge_fix_test.rb +0 -55
  385. data/test_graveyard/unit/busted/dependinator_test.rb +0 -129
  386. data/test_graveyard/unit/busted/file_finder_helper_test.rb +0 -45
  387. data/test_graveyard/unit/busted/file_finder_test.rb +0 -114
  388. data/test_graveyard/unit/busted/file_path_utils_test.rb +0 -97
  389. data/test_graveyard/unit/busted/file_system_utils_test.rb +0 -21
  390. data/test_graveyard/unit/busted/generator_test.rb +0 -187
  391. data/test_graveyard/unit/busted/generator_test_results_test.rb +0 -129
  392. data/test_graveyard/unit/busted/generator_test_runner_test.rb +0 -475
  393. data/test_graveyard/unit/busted/preprocessinator_file_handler_test.rb +0 -39
  394. data/test_graveyard/unit/busted/preprocessinator_helper_test.rb +0 -156
  395. data/test_graveyard/unit/busted/preprocessinator_includes_handler_test.rb +0 -93
  396. data/test_graveyard/unit/busted/preprocessinator_test.rb +0 -57
  397. data/test_graveyard/unit/busted/project_file_loader_test.rb +0 -142
  398. data/test_graveyard/unit/busted/setupinator_test.rb +0 -45
  399. data/test_graveyard/unit/busted/streaminator_test.rb +0 -49
  400. data/test_graveyard/unit/busted/task_invoker_test.rb +0 -69
  401. data/test_graveyard/unit/busted/test_includes_extractor_test.rb +0 -111
  402. data/test_graveyard/unit/busted/test_invoker_helper_test.rb +0 -62
  403. data/test_graveyard/unit/busted/test_invoker_test.rb +0 -47
  404. data/test_graveyard/unit/busted/tool_executor_helper_test.rb +0 -100
  405. data/test_graveyard/unit/busted/tool_executor_test.rb +0 -351
  406. data/test_graveyard/unit/busted/verbosinator_test.rb +0 -65
  407. data/test_graveyard/unit/preprocessinator_extractor_test.rb +0 -731
  408. data/test_graveyard/unit_test_helper.rb +0 -16
  409. data/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  410. data/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  411. data/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
  412. data/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  413. data/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  414. data/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  415. data/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  416. data/vendor/cmock/docs/CMock Summary.odt +0 -0
  417. data/vendor/cmock/docs/CMock Summary.pdf +0 -0
  418. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.odt +0 -0
  419. data/vendor/cmock/vendor/c_exception/docs/CExceptionSummary.pdf +0 -0
  420. data/vendor/cmock/vendor/c_exception/vendor/unity/auto/parseOutput.rb +0 -191
  421. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  422. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  423. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  424. data/vendor/cmock/vendor/c_exception/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  425. data/vendor/cmock/vendor/unity/auto/parseOutput.rb +0 -191
  426. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  427. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  428. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  429. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
  430. data/vendor/unity/auto/parseOutput.rb +0 -191
  431. data/vendor/unity/docs/UnityAssertionsReference.pdf +0 -0
  432. data/vendor/unity/docs/UnityConfigurationGuide.pdf +0 -0
  433. data/vendor/unity/docs/UnityGettingStartedGuide.pdf +0 -0
  434. data/vendor/unity/docs/UnityHelperScriptsGuide.pdf +0 -0
@@ -0,0 +1,220 @@
1
+ #============================================================
2
+ # Author: John Theofanopoulos
3
+ # A simple parser. Takes the output files generated during the build process and
4
+ # extracts information relating to the tests.
5
+ #
6
+ # Notes:
7
+ # To capture an output file under VS builds use the following:
8
+ # devenv [build instructions] > Output.txt & type Output.txt
9
+ #
10
+ # To capture an output file under GCC/Linux builds use the following:
11
+ # make | tee Output.txt
12
+ #
13
+ # To use this parser use the following command
14
+ # ruby parseOutput.rb [options] [file]
15
+ # options: -xml : produce a JUnit compatible XML file
16
+ # file : file to scan for results
17
+ #============================================================
18
+
19
+ class ParseOutput
20
+ def initialize
21
+ @test_flag = false
22
+ @xml_out = false
23
+ @array_list = false
24
+ @total_tests = false
25
+ @class_index = false
26
+ end
27
+
28
+ # Set the flag to indicate if there will be an XML output file or not
29
+ def set_xml_output
30
+ @xml_out = true
31
+ end
32
+
33
+ # if write our output to XML
34
+ def write_xml_output
35
+ output = File.open('report.xml', 'w')
36
+ output << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
37
+ @array_list.each do |item|
38
+ output << item << "\n"
39
+ end
40
+ output << "</testsuite>\n"
41
+ end
42
+
43
+ # This function will try and determine when the suite is changed. This is
44
+ # is the name that gets added to the classname parameter.
45
+ def test_suite_verify(test_suite_name)
46
+ return if @test_flag
47
+
48
+ @test_flag = true
49
+ # Split the path name
50
+ test_name = test_suite_name.split('/')
51
+ # Remove the extension
52
+ base_name = test_name[test_name.size - 1].split('.')
53
+ @test_suite = 'test.' + base_name[0]
54
+ printf "New Test: %s\n", @test_suite
55
+ end
56
+
57
+ # Test was flagged as having passed so format the output
58
+ def test_passed(array)
59
+ last_item = array.length - 1
60
+ test_name = array[last_item - 1]
61
+ test_suite_verify(array[@class_name])
62
+ printf "%-40s PASS\n", test_name
63
+
64
+ return unless @xml_out
65
+
66
+ @array_list.push ' <testcase classname="' + @test_suite + '" name="' + test_name + '"/>'
67
+ end
68
+
69
+ # Test was flagged as having passed so format the output.
70
+ # This is using the Unity fixture output and not the original Unity output.
71
+ def test_passed_unity_fixture(array)
72
+ test_suite = array[0].sub('TEST(', '')
73
+ test_suite = test_suite.sub(',', '')
74
+ test_name = array[1].sub(')', '')
75
+
76
+ return unless @xml_out
77
+
78
+ @array_list.push ' <testcase classname="' + test_suite + '" name="' + test_name + '"/>'
79
+ end
80
+
81
+ # Test was flagged as being ingored so format the output
82
+ def test_ignored(array)
83
+ last_item = array.length - 1
84
+ test_name = array[last_item - 2]
85
+ reason = array[last_item].chomp
86
+ test_suite_verify(array[@class_name])
87
+ printf "%-40s IGNORED\n", test_name
88
+
89
+ if test_name.start_with? 'TEST('
90
+ array2 = test_name.split(' ')
91
+ @test_suite = array2[0].sub('TEST(', '')
92
+ @test_suite = @test_suite.sub(',', '')
93
+ test_name = array2[1].sub(')', '')
94
+ end
95
+
96
+ return unless @xml_out
97
+
98
+ @array_list.push ' <testcase classname="' + @test_suite + '" name="' + test_name + '">'
99
+ @array_list.push ' <skipped type="TEST IGNORED"> ' + reason + ' </skipped>'
100
+ @array_list.push ' </testcase>'
101
+ end
102
+
103
+ # Test was flagged as having failed so format the line
104
+ def test_failed(array)
105
+ last_item = array.length - 1
106
+ test_name = array[last_item - 2]
107
+ reason = array[last_item].chomp + ' at line: ' + array[last_item - 3]
108
+ test_suite_verify(array[@class_name])
109
+ printf "%-40s FAILED\n", test_name
110
+
111
+ if test_name.start_with? 'TEST('
112
+ array2 = test_name.split(' ')
113
+ @test_suite = array2[0].sub('TEST(', '')
114
+ @test_suite = @test_suite.sub(',', '')
115
+ test_name = array2[1].sub(')', '')
116
+ end
117
+
118
+ return unless @xml_out
119
+
120
+ @array_list.push ' <testcase classname="' + @test_suite + '" name="' + test_name + '">'
121
+ @array_list.push ' <failure type="ASSERT FAILED"> ' + reason + ' </failure>'
122
+ @array_list.push ' </testcase>'
123
+ end
124
+
125
+ # Figure out what OS we are running on. For now we are assuming if it's not Windows it must
126
+ # be Unix based.
127
+ def detect_os
128
+ os = RUBY_PLATFORM.split('-')
129
+ @class_name = if os.size == 2
130
+ if os[1] == 'mingw32'
131
+ 1
132
+ else
133
+ 0
134
+ end
135
+ else
136
+ 0
137
+ end
138
+ end
139
+
140
+ # Main function used to parse the file that was captured.
141
+ def process(name)
142
+ @test_flag = false
143
+ @array_list = []
144
+
145
+ detect_os
146
+
147
+ puts 'Parsing file: ' + name
148
+
149
+ test_pass = 0
150
+ test_fail = 0
151
+ test_ignore = 0
152
+ puts ''
153
+ puts '=================== RESULTS ====================='
154
+ puts ''
155
+ File.open(name).each do |line|
156
+ # Typical test lines look like this:
157
+ # <path>/<test_file>.c:36:test_tc1000_opsys:FAIL: Expected 1 Was 0
158
+ # <path>/<test_file>.c:112:test_tc5004_initCanChannel:IGNORE: Not Yet Implemented
159
+ # <path>/<test_file>.c:115:test_tc5100_initCanVoidPtrs:PASS
160
+ #
161
+ # where path is different on Unix vs Windows devices (Windows leads with a drive letter)
162
+ line_array = line.split(':')
163
+
164
+ # If we were able to split the line then we can look to see if any of our target words
165
+ # were found. Case is important.
166
+ if (line_array.size >= 4) || (line.start_with? 'TEST(')
167
+ # Determine if this test passed
168
+ if line.include? ':PASS'
169
+ test_passed(line_array)
170
+ test_pass += 1
171
+ elsif line.include? ':FAIL:'
172
+ test_failed(line_array)
173
+ test_fail += 1
174
+ elsif line.include? ':IGNORE:'
175
+ test_ignored(line_array)
176
+ test_ignore += 1
177
+ elsif line.start_with? 'TEST('
178
+ if line.include? ' PASS'
179
+ line_array = line.split(' ')
180
+ test_passed_unity_fixture(line_array)
181
+ test_pass += 1
182
+ end
183
+ # If none of the keywords are found there are no more tests for this suite so clear
184
+ # the test flag
185
+ else
186
+ @test_flag = false
187
+ end
188
+ else
189
+ @test_flag = false
190
+ end
191
+ end
192
+ puts ''
193
+ puts '=================== SUMMARY ====================='
194
+ puts ''
195
+ puts 'Tests Passed : ' + test_pass.to_s
196
+ puts 'Tests Failed : ' + test_fail.to_s
197
+ puts 'Tests Ignored : ' + test_ignore.to_s
198
+ @total_tests = test_pass + test_fail + test_ignore
199
+
200
+ return unless @xml_out
201
+
202
+ heading = '<testsuite tests="' + @total_tests.to_s + '" failures="' + test_fail.to_s + '"' + ' skips="' + test_ignore.to_s + '">'
203
+ @array_list.insert(0, heading)
204
+ write_xml_output
205
+ end
206
+ end
207
+
208
+ # If the command line has no values in, used a default value of Output.txt
209
+ parse_my_file = ParseOutput.new
210
+
211
+ if ARGV.size >= 1
212
+ ARGV.each do |a|
213
+ if a == '-xml'
214
+ parse_my_file.set_xml_output
215
+ else
216
+ parse_my_file.process(a)
217
+ break
218
+ end
219
+ end
220
+ end
@@ -12,7 +12,6 @@ require 'pp'
12
12
  VERSION = 1.0
13
13
 
14
14
  class ArgvParser
15
-
16
15
  #
17
16
  # Return a structure describing the options.
18
17
  #
@@ -20,41 +19,41 @@ class ArgvParser
20
19
  # The options specified on the command line will be collected in *options*.
21
20
  # We set default values here.
22
21
  options = OpenStruct.new
23
- options.results_dir = "."
24
- options.root_path = "."
25
- options.out_file = "results.xml"
22
+ options.results_dir = '.'
23
+ options.root_path = '.'
24
+ options.out_file = 'results.xml'
26
25
 
27
- opts = OptionParser.new do |opts|
28
- opts.banner = "Usage: unity_to_junit.rb [options]"
26
+ opts = OptionParser.new do |o|
27
+ o.banner = 'Usage: unity_to_junit.rb [options]'
29
28
 
30
- opts.separator ""
31
- opts.separator "Specific options:"
29
+ o.separator ''
30
+ o.separator 'Specific options:'
32
31
 
33
- opts.on("-r", "--results <dir>", "Look for Unity Results files here.") do |results|
34
- #puts "results #{results}"
32
+ o.on('-r', '--results <dir>', 'Look for Unity Results files here.') do |results|
33
+ # puts "results #{results}"
35
34
  options.results_dir = results
36
35
  end
37
36
 
38
- opts.on("-p", "--root_path <path>", "Prepend this path to files in results.") do |root_path|
37
+ o.on('-p', '--root_path <path>', 'Prepend this path to files in results.') do |root_path|
39
38
  options.root_path = root_path
40
39
  end
41
40
 
42
- opts.on("-o", "--output <filename>", "XML file to generate.") do |out_file|
43
- #puts "out_file: #{out_file}"
41
+ o.on('-o', '--output <filename>', 'XML file to generate.') do |out_file|
42
+ # puts "out_file: #{out_file}"
44
43
  options.out_file = out_file
45
44
  end
46
45
 
47
- opts.separator ""
48
- opts.separator "Common options:"
46
+ o.separator ''
47
+ o.separator 'Common options:'
49
48
 
50
49
  # No argument, shows at tail. This will print an options summary.
51
- opts.on_tail("-h", "--help", "Show this message") do
52
- puts opts
50
+ o.on_tail('-h', '--help', 'Show this message') do
51
+ puts o
53
52
  exit
54
53
  end
55
54
 
56
55
  # Another typical switch to print the version.
57
- opts.on_tail("--version", "Show version") do
56
+ o.on_tail('--version', 'Show version') do
58
57
  puts "unity_to_junit.rb version #{VERSION}"
59
58
  exit
60
59
  end
@@ -62,13 +61,13 @@ class ArgvParser
62
61
 
63
62
  opts.parse!(args)
64
63
  options
65
- end # parse()
66
-
67
- end # class OptparseExample
64
+ end # parse()
65
+ end # class OptparseExample
68
66
 
69
67
  class UnityToJUnit
70
68
  include FileUtils::Verbose
71
69
  attr_reader :report, :total_tests, :failures, :ignored
70
+ attr_writer :targets, :root, :out_file
72
71
 
73
72
  def initialize
74
73
  @report = ''
@@ -77,125 +76,115 @@ class UnityToJUnit
77
76
 
78
77
  def run
79
78
  # Clean up result file names
80
- results = @targets.map {|target| target.gsub(/\\/,"/")}
81
- #puts "Output File: #{@out_file}"
82
- f = File.new(@out_file, "w")
79
+ results = @targets.map { |target| target.tr('\\', '/') }
80
+ # puts "Output File: #{@out_file}"
81
+ f = File.new(@out_file, 'w')
83
82
  write_xml_header(f)
84
- write_suites_header( f )
83
+ write_suites_header(f)
85
84
  results.each do |result_file|
86
- lines = File.readlines(result_file).map { |line| line.chomp }
87
- if lines.length == 0
88
- raise "Empty test result file: #{result_file}"
89
- else
90
- result_output = get_details(result_file, lines)
91
- tests,failures,ignored = parse_test_summary(lines)
92
- result_output[:counts][:total] = tests
93
- result_output[:counts][:failed] = failures
94
- result_output[:counts][:ignored] = ignored
95
- result_output[:counts][:passed] = (result_output[:counts][:total] - result_output[:counts][:failed] - result_output[:counts][:ignored])
96
- end
97
- #use line[0] from the test output to get the test_file path and name
98
- test_file_str = lines[0].gsub("\\","/")
99
- test_file_str = test_file_str.split(":")
100
- test_file = if (test_file_str.length < 2)
101
- result_file
102
- else
103
- test_file_str[0] + ':' + test_file_str[1]
104
- end
85
+ lines = File.readlines(result_file).map(&:chomp)
86
+
87
+ raise "Empty test result file: #{result_file}" if lines.empty?
88
+
89
+ result_output = get_details(result_file, lines)
90
+ tests, failures, ignored = parse_test_summary(lines)
91
+ result_output[:counts][:total] = tests
92
+ result_output[:counts][:failed] = failures
93
+ result_output[:counts][:ignored] = ignored
94
+ result_output[:counts][:passed] = (result_output[:counts][:total] - result_output[:counts][:failed] - result_output[:counts][:ignored])
95
+
96
+ # use line[0] from the test output to get the test_file path and name
97
+ test_file_str = lines[0].tr('\\', '/')
98
+ test_file_str = test_file_str.split(':')
99
+ test_file = if test_file_str.length < 2
100
+ result_file
101
+ else
102
+ test_file_str[0] + ':' + test_file_str[1]
103
+ end
105
104
  result_output[:source][:path] = File.dirname(test_file)
106
105
  result_output[:source][:file] = File.basename(test_file)
107
106
 
108
107
  # save result_output
109
- @unit_name = File.basename(test_file, ".*")
108
+ @unit_name = File.basename(test_file, '.*')
110
109
 
111
- write_suite_header( result_output[:counts], f)
112
- write_failures( result_output, f )
113
- write_tests( result_output, f )
114
- write_ignored( result_output, f )
115
- write_suite_footer( f )
110
+ write_suite_header(result_output[:counts], f)
111
+ write_failures(result_output, f)
112
+ write_tests(result_output, f)
113
+ write_ignored(result_output, f)
114
+ write_suite_footer(f)
116
115
  end
117
- write_suites_footer( f )
116
+ write_suites_footer(f)
118
117
  f.close
119
118
  end
120
119
 
121
- def set_targets(target_array)
122
- @targets = target_array
123
- end
124
-
125
- def set_root_path(path)
126
- @root = path
127
- end
128
- def set_out_file(filename)
129
- @out_file = filename
130
- end
131
- def usage(err_msg=nil)
120
+ def usage(err_msg = nil)
132
121
  puts "\nERROR: "
133
122
  puts err_msg if err_msg
134
- puts "Usage: unity_to_junit.rb [options]"
135
- puts ""
136
- puts "Specific options:"
137
- puts " -r, --results <dir> Look for Unity Results files here."
138
- puts " -p, --root_path <path> Prepend this path to files in results."
139
- puts " -o, --output <filename> XML file to generate."
140
- puts ""
141
- puts "Common options:"
142
- puts " -h, --help Show this message"
143
- puts " --version Show version"
123
+ puts 'Usage: unity_to_junit.rb [options]'
124
+ puts ''
125
+ puts 'Specific options:'
126
+ puts ' -r, --results <dir> Look for Unity Results files here.'
127
+ puts ' -p, --root_path <path> Prepend this path to files in results.'
128
+ puts ' -o, --output <filename> XML file to generate.'
129
+ puts ''
130
+ puts 'Common options:'
131
+ puts ' -h, --help Show this message'
132
+ puts ' --version Show version'
144
133
 
145
134
  exit 1
146
135
  end
147
136
 
148
137
  protected
149
- def get_details(result_file, lines)
150
- results = get_results_structure
138
+
139
+ def get_details(_result_file, lines)
140
+ results = results_structure
151
141
  lines.each do |line|
152
- line = line.gsub("\\","/")
153
- src_file,src_line,test_name,status,msg = line.split(/:/)
154
- line_out = ((@root and (@root != 0)) ? "#{@root}#{line}" : line ).gsub(/\//, "\\")
155
- case(status)
156
- when 'IGNORE' then results[:ignores] << {:test => test_name, :line => src_line, :message => msg}
157
- when 'FAIL' then results[:failures] << {:test => test_name, :line => src_line, :message => msg}
158
- when 'PASS' then results[:successes] << {:test => test_name, :line => src_line, :message => msg}
142
+ line = line.tr('\\', '/')
143
+ _src_file, src_line, test_name, status, msg = line.split(/:/)
144
+ case status
145
+ when 'IGNORE' then results[:ignores] << { test: test_name, line: src_line, message: msg }
146
+ when 'FAIL' then results[:failures] << { test: test_name, line: src_line, message: msg }
147
+ when 'PASS' then results[:successes] << { test: test_name, line: src_line, message: msg }
159
148
  end
160
149
  end
161
- return results
150
+ results
162
151
  end
163
152
 
164
153
  def parse_test_summary(summary)
165
- if summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ }
166
- [$1.to_i,$2.to_i,$3.to_i]
167
- else
168
- raise "Couldn't parse test results: #{summary}"
169
- end
154
+ raise "Couldn't parse test results: #{summary}" unless summary.find { |v| v =~ /(\d+) Tests (\d+) Failures (\d+) Ignored/ }
155
+ [Regexp.last_match(1).to_i, Regexp.last_match(2).to_i, Regexp.last_match(3).to_i]
156
+ end
157
+
158
+ def here
159
+ File.expand_path(File.dirname(__FILE__))
170
160
  end
171
- def here; File.expand_path(File.dirname(__FILE__)); end
172
161
 
173
162
  private
174
163
 
175
- def get_results_structure
176
- return {
177
- :source => {:path => '', :file => ''},
178
- :successes => [],
179
- :failures => [],
180
- :ignores => [],
181
- :counts => {:total => 0, :passed => 0, :failed => 0, :ignored => 0},
182
- :stdout => [],
164
+ def results_structure
165
+ {
166
+ source: { path: '', file: '' },
167
+ successes: [],
168
+ failures: [],
169
+ ignores: [],
170
+ counts: { total: 0, passed: 0, failed: 0, ignored: 0 },
171
+ stdout: []
183
172
  }
184
173
  end
185
174
 
186
- def write_xml_header( stream )
175
+ def write_xml_header(stream)
187
176
  stream.puts "<?xml version='1.0' encoding='utf-8' ?>"
188
177
  end
189
178
 
190
- def write_suites_header( stream )
191
- stream.puts "<testsuites>"
179
+ def write_suites_header(stream)
180
+ stream.puts '<testsuites>'
192
181
  end
193
182
 
194
- def write_suite_header( counts, stream )
183
+ def write_suite_header(counts, stream)
195
184
  stream.puts "\t<testsuite errors=\"0\" skipped=\"#{counts[:ignored]}\" failures=\"#{counts[:failed]}\" tests=\"#{counts[:total]}\" name=\"unity\">"
196
185
  end
197
186
 
198
- def write_failures( results, stream )
187
+ def write_failures(results, stream)
199
188
  result = results[:failures]
200
189
  result.each do |item|
201
190
  filename = File.join(results[:source][:path], File.basename(results[:source][:file], '.*'))
@@ -206,15 +195,14 @@ class UnityToJUnit
206
195
  end
207
196
  end
208
197
 
209
- def write_tests( results, stream )
198
+ def write_tests(results, stream)
210
199
  result = results[:successes]
211
200
  result.each do |item|
212
- filename = File.join(results[:source][:path], File.basename(results[:source][:file], '.*'))
213
201
  stream.puts "\t\t<testcase classname=\"#{@unit_name}\" name=\"#{item[:test]}\" time=\"0\" />"
214
202
  end
215
203
  end
216
204
 
217
- def write_ignored( results, stream )
205
+ def write_ignored(results, stream)
218
206
  result = results[:ignores]
219
207
  result.each do |item|
220
208
  filename = File.join(results[:source][:path], File.basename(results[:source][:file], '.*'))
@@ -226,39 +214,39 @@ class UnityToJUnit
226
214
  end
227
215
  end
228
216
 
229
- def write_suite_footer( stream )
217
+ def write_suite_footer(stream)
230
218
  stream.puts "\t</testsuite>"
231
219
  end
232
220
 
233
- def write_suites_footer( stream )
234
- stream.puts "</testsuites>"
221
+ def write_suites_footer(stream)
222
+ stream.puts '</testsuites>'
235
223
  end
236
- end #UnityToJUnit
224
+ end # UnityToJUnit
237
225
 
238
226
  if __FILE__ == $0
239
- #parse out the command options
227
+ # parse out the command options
240
228
  options = ArgvParser.parse(ARGV)
241
229
 
242
- #create an instance to work with
230
+ # create an instance to work with
243
231
  utj = UnityToJUnit.new
244
232
  begin
245
- #look in the specified or current directory for result files
246
- targets = "#{options.results_dir.gsub(/\\/, '/')}**/*.test*"
233
+ # look in the specified or current directory for result files
234
+ targets = "#{options.results_dir.tr('\\', '/')}**/*.test*"
247
235
 
248
236
  results = Dir[targets]
249
237
  raise "No *.testpass, *.testfail, or *.testresults files found in '#{targets}'" if results.empty?
250
- utj.set_targets(results)
238
+ utj.targets = results
251
239
 
252
- #set the root path
253
- utj.set_root_path(options.root_path)
240
+ # set the root path
241
+ utj.root = options.root_path
254
242
 
255
- #set the output XML file name
256
- #puts "Output File from options: #{options.out_file}"
257
- utj.set_out_file(options.out_file)
243
+ # set the output XML file name
244
+ # puts "Output File from options: #{options.out_file}"
245
+ utj.out_file = options.out_file
258
246
 
259
- #run the summarizer
247
+ # run the summarizer
260
248
  puts utj.run
261
- rescue Exception => e
249
+ rescue StandardError => e
262
250
  utj.usage e.message
263
251
  end
264
252
  end