ceedling 0.25.0 → 0.27.0

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -2,7 +2,7 @@ Unity Test API
2
2
  ==============
3
3
 
4
4
  [![Unity Build Status](https://api.travis-ci.org/ThrowTheSwitch/Unity.png?branch=master)](https://travis-ci.org/ThrowTheSwitch/Unity)
5
- __Copyright (c) 2007 - 2014 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
5
+ __Copyright (c) 2007 - 2017 Unity Project by Mike Karlesky, Mark VanderVoord, and Greg Williams__
6
6
 
7
7
  Running Tests
8
8
  -------------
@@ -41,13 +41,13 @@ Example:
41
41
 
42
42
  main()
43
43
  {
44
- if (TEST_PROTECT() == 0)
44
+ if (TEST_PROTECT())
45
45
  {
46
46
  MyTest();
47
47
  }
48
48
  }
49
49
 
50
- If MyTest calls `TEST_ABORT`, program control will immediately return to `TEST_PROTECT` with a non-zero return value.
50
+ If MyTest calls `TEST_ABORT`, program control will immediately return to `TEST_PROTECT` with a return value of zero.
51
51
 
52
52
 
53
53
  Unity Assertion Summary
@@ -109,6 +109,18 @@ Compares two integers for equality and display errors as hexadecimal. Like the
109
109
  you can specify the size... here the size will also effect how many nibbles are shown (for example, `HEX16`
110
110
  will show 4 nibbles).
111
111
 
112
+ TEST_ASSERT_EQUAL(expected, actual)
113
+
114
+ Another way of calling TEST_ASSERT_EQUAL_INT
115
+
116
+ TEST_ASSERT_INT_WITHIN(delta, expected, actual)
117
+
118
+ Asserts that the actual value is within plus or minus delta of the expected value. This also comes in
119
+ size specific variants.
120
+
121
+ Arrays
122
+ ------
123
+
112
124
  _ARRAY
113
125
 
114
126
  You can append `_ARRAY` to any of these macros to make an array comparison of that type. Here you will
@@ -117,15 +129,12 @@ additional argument which is the number of elements to compare. For example:
117
129
 
118
130
  TEST_ASSERT_EQUAL_HEX8_ARRAY(expected, actual, elements)
119
131
 
120
- TEST_ASSERT_EQUAL(expected, actual)
121
-
122
- Another way of calling TEST_ASSERT_EQUAL_INT
123
-
124
- TEST_ASSERT_INT_WITHIN(delta, expected, actual)
132
+ _EACH_EQUAL
125
133
 
126
- Asserts that the actual value is within plus or minus delta of the expected value. This also comes in
127
- size specific variants.
134
+ Another array comparison option is to check that EVERY element of an array is equal to a single expected
135
+ value. You do this by specifying the EACH_EQUAL macro. For example:
128
136
 
137
+ TEST_ASSERT_EACH_EQUAL_INT32(expected, actual, elements)
129
138
 
130
139
  Numerical Assertions: Bitwise
131
140
  -----------------------------
@@ -4,63 +4,62 @@
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
5
  # ==========================================
6
6
 
7
- if RUBY_PLATFORM =~/(win|w)32$/
8
- begin
9
- require 'Win32API'
10
- rescue LoadError
11
- puts "ERROR! \"Win32API\" library not found"
12
- puts "\"Win32API\" is required for colour on a windows machine"
13
- puts " try => \"gem install Win32API\" on the command line"
14
- puts
15
- end
16
- # puts
7
+ if RUBY_PLATFORM =~ /(win|w)32$/
8
+ begin
9
+ require 'Win32API'
10
+ rescue LoadError
11
+ puts 'ERROR! "Win32API" library not found'
12
+ puts '"Win32API" is required for colour on a windows machine'
13
+ puts ' try => "gem install Win32API" on the command line'
14
+ puts
15
+ end
16
+ # puts
17
17
  # puts 'Windows Environment Detected...'
18
- # puts 'Win32API Library Found.'
19
- # puts
18
+ # puts 'Win32API Library Found.'
19
+ # puts
20
20
  end
21
21
 
22
22
  class ColourCommandLine
23
23
  def initialize
24
- if RUBY_PLATFORM =~/(win|w)32$/
25
- get_std_handle = Win32API.new("kernel32", "GetStdHandle", ['L'], 'L')
26
- @set_console_txt_attrb =
27
- Win32API.new("kernel32","SetConsoleTextAttribute",['L','N'], 'I')
28
- @hout = get_std_handle.call(-11)
29
- end
24
+ return unless RUBY_PLATFORM =~ /(win|w)32$/
25
+ get_std_handle = Win32API.new('kernel32', 'GetStdHandle', ['L'], 'L')
26
+ @set_console_txt_attrb =
27
+ Win32API.new('kernel32', 'SetConsoleTextAttribute', %w(L N), 'I')
28
+ @hout = get_std_handle.call(-11)
30
29
  end
31
30
 
32
31
  def change_to(new_colour)
33
- if RUBY_PLATFORM =~/(win|w)32$/
34
- @set_console_txt_attrb.call(@hout,self.win32_colour(new_colour))
32
+ if RUBY_PLATFORM =~ /(win|w)32$/
33
+ @set_console_txt_attrb.call(@hout, win32_colour(new_colour))
35
34
  else
36
- "\033[30;#{posix_colour(new_colour)};22m"
37
- end
35
+ "\033[30;#{posix_colour(new_colour)};22m"
36
+ end
38
37
  end
39
38
 
40
39
  def win32_colour(colour)
41
40
  case colour
42
- when :black then 0
43
- when :dark_blue then 1
44
- when :dark_green then 2
45
- when :dark_cyan then 3
46
- when :dark_red then 4
47
- when :dark_purple then 5
48
- when :dark_yellow, :narrative then 6
49
- when :default_white, :default, :dark_white then 7
50
- when :silver then 8
51
- when :blue then 9
52
- when :green, :success then 10
53
- when :cyan, :output then 11
54
- when :red, :failure then 12
55
- when :purple then 13
56
- when :yellow then 14
57
- when :white then 15
58
- else
59
- 0
41
+ when :black then 0
42
+ when :dark_blue then 1
43
+ when :dark_green then 2
44
+ when :dark_cyan then 3
45
+ when :dark_red then 4
46
+ when :dark_purple then 5
47
+ when :dark_yellow, :narrative then 6
48
+ when :default_white, :default, :dark_white then 7
49
+ when :silver then 8
50
+ when :blue then 9
51
+ when :green, :success then 10
52
+ when :cyan, :output then 11
53
+ when :red, :failure then 12
54
+ when :purple then 13
55
+ when :yellow then 14
56
+ when :white then 15
57
+ else
58
+ 0
60
59
  end
61
60
  end
62
61
 
63
- def posix_colour(colour)
62
+ def posix_colour(colour)
64
63
  # ANSI Escape Codes - Foreground colors
65
64
  # | Code | Color |
66
65
  # | 39 | Default foreground color |
@@ -81,35 +80,39 @@ class ColourCommandLine
81
80
  # | 96 | Light cyan |
82
81
  # | 97 | White |
83
82
 
84
- case colour
85
- when :black then 30
86
- when :red, :failure then 31
87
- when :green, :success then 32
88
- when :yellow then 33
89
- when :blue, :narrative then 34
90
- when :purple, :magenta then 35
91
- when :cyan, :output then 36
92
- when :white, :default_white then 37
93
- when :default then 39
94
- else
95
- 39
83
+ case colour
84
+ when :black then 30
85
+ when :red, :failure then 31
86
+ when :green, :success then 32
87
+ when :yellow then 33
88
+ when :blue, :narrative then 34
89
+ when :purple, :magenta then 35
90
+ when :cyan, :output then 36
91
+ when :white, :default_white then 37
92
+ when :default then 39
93
+ else
94
+ 39
96
95
  end
97
96
  end
98
97
 
99
98
  def out_c(mode, colour, str)
100
99
  case RUBY_PLATFORM
101
- when /(win|w)32$/
102
- change_to(colour)
103
- $stdout.puts str if mode == :puts
104
- $stdout.print str if mode == :print
105
- change_to(:default_white)
106
- else
107
- $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts
108
- $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
109
- end
100
+ when /(win|w)32$/
101
+ change_to(colour)
102
+ $stdout.puts str if mode == :puts
103
+ $stdout.print str if mode == :print
104
+ change_to(:default_white)
105
+ else
106
+ $stdout.puts("#{change_to(colour)}#{str}\033[0m") if mode == :puts
107
+ $stdout.print("#{change_to(colour)}#{str}\033[0m") if mode == :print
108
+ end
110
109
  end
111
110
  end # ColourCommandLine
112
111
 
113
- def colour_puts(role,str) ColourCommandLine.new.out_c(:puts, role, str) end
114
- def colour_print(role,str) ColourCommandLine.new.out_c(:print, role, str) end
112
+ def colour_puts(role, str)
113
+ ColourCommandLine.new.out_c(:puts, role, str)
114
+ end
115
115
 
116
+ def colour_print(role, str)
117
+ ColourCommandLine.new.out_c(:print, role, str)
118
+ end
@@ -2,38 +2,38 @@
2
2
  # Unity Project - A Test Framework for C
3
3
  # Copyright (c) 2007 Mike Karlesky, Mark VanderVoord, Greg Williams
4
4
  # [Released under MIT License. Please refer to license.txt for details]
5
- # ==========================================
5
+ # ==========================================
6
6
 
7
7
  require "#{File.expand_path(File.dirname(__FILE__))}/colour_prompt"
8
8
 
9
9
  $colour_output = true
10
10
 
11
11
  def report(message)
12
- if not $colour_output
12
+ if !$colour_output
13
13
  $stdout.puts(message)
14
14
  else
15
- message = message.join('\n') if (message.class == Array)
15
+ message = message.join('\n') if message.class == Array
16
16
  message.each_line do |line|
17
17
  line.chomp!
18
- colour = case(line)
19
- when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i
20
- ($1.to_i == 0) ? :green : :red
21
- when /PASS/
22
- :green
23
- when /^OK$/
24
- :green
25
- when /(?:FAIL|ERROR)/
26
- :red
27
- when /IGNORE/
28
- :yellow
29
- when /^(?:Creating|Compiling|Linking)/
30
- :white
31
- else
32
- :silver
33
- end
18
+ colour = case line
19
+ when /(?:total\s+)?tests:?\s+(\d+)\s+(?:total\s+)?failures:?\s+\d+\s+Ignored:?/i
20
+ Regexp.last_match(1).to_i.zero? ? :green : :red
21
+ when /PASS/
22
+ :green
23
+ when /^OK$/
24
+ :green
25
+ when /(?:FAIL|ERROR)/
26
+ :red
27
+ when /IGNORE/
28
+ :yellow
29
+ when /^(?:Creating|Compiling|Linking)/
30
+ :white
31
+ else
32
+ :silver
33
+ end
34
34
  colour_puts(colour, line)
35
35
  end
36
36
  end
37
37
  $stdout.flush
38
38
  $stderr.flush
39
- end
39
+ end
@@ -12,8 +12,8 @@ require 'rubygems'
12
12
  require 'fileutils'
13
13
  require 'pathname'
14
14
 
15
- #TEMPLATE_TST
16
- TEMPLATE_TST ||= %q[#include "unity.h"
15
+ # TEMPLATE_TST
16
+ TEMPLATE_TST ||= '#include "unity.h"
17
17
  %2$s#include "%1$s.h"
18
18
 
19
19
  void setUp(void)
@@ -28,115 +28,118 @@ void test_%1$s_NeedToImplement(void)
28
28
  {
29
29
  TEST_IGNORE_MESSAGE("Need to Implement %1$s");
30
30
  }
31
- ]
31
+ '.freeze
32
32
 
33
- #TEMPLATE_SRC
34
- TEMPLATE_SRC ||= %q[%2$s#include "%1$s.h"
35
- ]
33
+ # TEMPLATE_SRC
34
+ TEMPLATE_SRC ||= '%2$s#include "%1$s.h"
35
+ '.freeze
36
36
 
37
- #TEMPLATE_INC
38
- TEMPLATE_INC ||= %q[#ifndef _%3$s_H
37
+ # TEMPLATE_INC
38
+ TEMPLATE_INC ||= '#ifndef _%3$s_H
39
39
  #define _%3$s_H
40
40
  %2$s
41
41
 
42
42
  #endif // _%3$s_H
43
- ]
43
+ '.freeze
44
44
 
45
45
  class UnityModuleGenerator
46
-
47
46
  ############################
48
- def initialize(options=nil)
49
-
47
+ def initialize(options = nil)
50
48
  here = File.expand_path(File.dirname(__FILE__)) + '/'
51
49
 
52
50
  @options = UnityModuleGenerator.default_options
53
- case(options)
54
- when NilClass then @options
55
- when String then @options.merge!(UnityModuleGenerator.grab_config(options))
56
- when Hash then @options.merge!(options)
57
- else raise "If you specify arguments, it should be a filename or a hash of options"
51
+ case options
52
+ when NilClass then @options
53
+ when String then @options.merge!(UnityModuleGenerator.grab_config(options))
54
+ when Hash then @options.merge!(options)
55
+ else raise 'If you specify arguments, it should be a filename or a hash of options'
58
56
  end
59
57
 
60
58
  # Create default file paths if none were provided
61
- @options[:path_src] = here + "../src/" if @options[:path_src].nil?
59
+ @options[:path_src] = here + '../src/' if @options[:path_src].nil?
62
60
  @options[:path_inc] = @options[:path_src] if @options[:path_inc].nil?
63
- @options[:path_tst] = here + "../test/" if @options[:path_tst].nil?
64
- @options[:path_src] += '/' unless (@options[:path_src][-1] == 47)
65
- @options[:path_inc] += '/' unless (@options[:path_inc][-1] == 47)
66
- @options[:path_tst] += '/' unless (@options[:path_tst][-1] == 47)
67
-
68
- #Built in patterns
69
- @patterns = { 'src' => {'' => { :inc => [] } },
70
- 'test'=> {'' => { :inc => [] } },
71
- 'dh' => {'Driver' => { :inc => [create_filename('%1$s','Hardware.h')] },
72
- 'Hardware' => { :inc => [] }
73
- },
74
- 'dih' => {'Driver' => { :inc => [create_filename('%1$s','Hardware.h'), create_filename('%1$s','Interrupt.h')] },
75
- 'Interrupt'=> { :inc => [create_filename('%1$s','Hardware.h')] },
76
- 'Hardware' => { :inc => [] }
77
- },
78
- 'mch' => {'Model' => { :inc => [] },
79
- 'Conductor'=> { :inc => [create_filename('%1$s','Model.h'), create_filename('%1$s','Hardware.h')] },
80
- 'Hardware' => { :inc => [] }
81
- },
82
- 'mvp' => {'Model' => { :inc => [] },
83
- 'Presenter'=> { :inc => [create_filename('%1$s','Model.h'), create_filename('%1$s','View.h')] },
84
- 'View' => { :inc => [] }
85
- }
86
- }
61
+ @options[:path_tst] = here + '../test/' if @options[:path_tst].nil?
62
+ @options[:path_src] += '/' unless @options[:path_src][-1] == 47
63
+ @options[:path_inc] += '/' unless @options[:path_inc][-1] == 47
64
+ @options[:path_tst] += '/' unless @options[:path_tst][-1] == 47
65
+
66
+ # Built in patterns
67
+ @patterns = {
68
+ 'src' => {
69
+ '' => { inc: [] }
70
+ },
71
+ 'test' => {
72
+ '' => { inc: [] }
73
+ },
74
+ 'dh' => {
75
+ 'Driver' => { inc: [create_filename('%1$s', 'Hardware.h')] },
76
+ 'Hardware' => { inc: [] }
77
+ },
78
+ 'dih' => {
79
+ 'Driver' => { inc: [create_filename('%1$s', 'Hardware.h'), create_filename('%1$s', 'Interrupt.h')] },
80
+ 'Interrupt' => { inc: [create_filename('%1$s', 'Hardware.h')] },
81
+ 'Hardware' => { inc: [] }
82
+ },
83
+ 'mch' => {
84
+ 'Model' => { inc: [] },
85
+ 'Conductor' => { inc: [create_filename('%1$s', 'Model.h'), create_filename('%1$s', 'Hardware.h')] },
86
+ 'Hardware' => { inc: [] }
87
+ },
88
+ 'mvp' => {
89
+ 'Model' => { inc: [] },
90
+ 'Presenter' => { inc: [create_filename('%1$s', 'Model.h'), create_filename('%1$s', 'View.h')] },
91
+ 'View' => { inc: [] }
92
+ }
93
+ }
87
94
  end
88
95
 
89
96
  ############################
90
97
  def self.default_options
91
98
  {
92
- :pattern => "src",
93
- :includes =>
94
- {
95
- :src => [],
96
- :inc => [],
97
- :tst => [],
99
+ pattern: 'src',
100
+ includes: {
101
+ src: [],
102
+ inc: [],
103
+ tst: []
98
104
  },
99
- :update_svn => false,
100
- :boilerplates => {},
101
- :test_prefix => 'Test',
102
- :mock_prefix => 'Mock',
105
+ update_svn: false,
106
+ boilerplates: {},
107
+ test_prefix: 'Test',
108
+ mock_prefix: 'Mock'
103
109
  }
104
110
  end
105
111
 
106
112
  ############################
107
113
  def self.grab_config(config_file)
108
- options = self.default_options
109
- unless (config_file.nil? or config_file.empty?)
114
+ options = default_options
115
+ unless config_file.nil? || config_file.empty?
110
116
  require 'yaml'
111
117
  yaml_guts = YAML.load_file(config_file)
112
118
  options.merge!(yaml_guts[:unity] || yaml_guts[:cmock])
113
119
  raise "No :unity or :cmock section found in #{config_file}" unless options
114
120
  end
115
- return(options)
121
+ options
116
122
  end
117
123
 
118
124
  ############################
119
- def files_to_operate_on(module_name, pattern=nil)
120
- #strip any leading path information from the module name and save for later
125
+ def files_to_operate_on(module_name, pattern = nil)
126
+ # strip any leading path information from the module name and save for later
121
127
  subfolder = File.dirname(module_name)
122
128
  module_name = File.basename(module_name)
123
129
 
124
- #create triad definition
130
+ # create triad definition
125
131
  prefix = @options[:test_prefix] || 'Test'
126
- triad = [ { :ext => '.c', :path => @options[:path_src], :prefix => "", :template => TEMPLATE_SRC, :inc => :src, :boilerplate => @options[:boilerplates][:src] },
127
- { :ext => '.h', :path => @options[:path_inc], :prefix => "", :template => TEMPLATE_INC, :inc => :inc, :boilerplate => @options[:boilerplates][:inc] },
128
- { :ext => '.c', :path => @options[:path_tst], :prefix => prefix, :template => TEMPLATE_TST, :inc => :tst, :boilerplate => @options[:boilerplates][:tst] },
129
- ]
132
+ triad = [{ ext: '.c', path: @options[:path_src], prefix: '', template: TEMPLATE_SRC, inc: :src, boilerplate: @options[:boilerplates][:src] },
133
+ { ext: '.h', path: @options[:path_inc], prefix: '', template: TEMPLATE_INC, inc: :inc, boilerplate: @options[:boilerplates][:inc] },
134
+ { ext: '.c', path: @options[:path_tst], prefix: prefix, template: TEMPLATE_TST, inc: :tst, boilerplate: @options[:boilerplates][:tst] }]
130
135
 
131
- #prepare the pattern for use
136
+ # prepare the pattern for use
132
137
  pattern = (pattern || @options[:pattern] || 'src').downcase
133
138
  patterns = @patterns[pattern]
134
139
  raise "ERROR: The design pattern '#{pattern}' specified isn't one that I recognize!" if patterns.nil?
135
140
 
136
- #single file patterns (currently just 'test') can reject the other parts of the triad
137
- if (pattern == 'test')
138
- triad.reject!{|v| v[:inc] != :tst }
139
- end
141
+ # single file patterns (currently just 'test') can reject the other parts of the triad
142
+ triad.select! { |v| v[:inc] == :tst } if pattern == 'test'
140
143
 
141
144
  # Assemble the path/names of the files we need to work with.
142
145
  files = []
@@ -145,26 +148,26 @@ class UnityModuleGenerator
145
148
  submodule_name = create_filename(module_name, pattern_file)
146
149
  filename = cfg[:prefix] + submodule_name + cfg[:ext]
147
150
  files << {
148
- :path => (Pathname.new("#{cfg[:path]}#{subfolder}") + filename).cleanpath,
149
- :name => submodule_name,
150
- :template => cfg[:template],
151
- :boilerplate => cfg[:boilerplate],
152
- :includes => case(cfg[:inc])
153
- when :src then (@options[:includes][:src] || []) | pattern_traits[:inc].map{|f| f % [module_name]}
154
- when :inc then (@options[:includes][:inc] || [])
155
- when :tst then (@options[:includes][:tst] || []) | pattern_traits[:inc].map{|f| "#{@options[:mock_prefix]}#{f}" % [module_name]}
156
- end
151
+ path: (Pathname.new("#{cfg[:path]}#{subfolder}") + filename).cleanpath,
152
+ name: submodule_name,
153
+ template: cfg[:template],
154
+ boilerplate: cfg[:boilerplate],
155
+ includes: case (cfg[:inc])
156
+ when :src then (@options[:includes][:src] || []) | (pattern_traits[:inc].map { |f| format(f, module_name) })
157
+ when :inc then (@options[:includes][:inc] || [])
158
+ when :tst then (@options[:includes][:tst] || []) | (pattern_traits[:inc].map { |f| format("#{@options[:mock_prefix]}#{f}", module_name) })
159
+ end
157
160
  }
158
161
  end
159
162
  end
160
163
 
161
- return files
164
+ files
162
165
  end
163
166
 
164
167
  ############################
165
- def create_filename(part1, part2="")
168
+ def create_filename(part1, part2 = '')
166
169
  if part2.empty?
167
- case(@options[:naming])
170
+ case (@options[:naming])
168
171
  when 'bumpy' then part1
169
172
  when 'camel' then part1
170
173
  when 'snake' then part1.downcase
@@ -172,39 +175,45 @@ class UnityModuleGenerator
172
175
  else part1.downcase
173
176
  end
174
177
  else
175
- case(@options[:naming])
178
+ case (@options[:naming])
176
179
  when 'bumpy' then part1 + part2
177
180
  when 'camel' then part1 + part2
178
- when 'snake' then part1.downcase + "_" + part2.downcase
179
- when 'caps' then part1.upcase + "_" + part2.upcase
180
- else part1.downcase + "_" + part2.downcase
181
+ when 'snake' then part1.downcase + '_' + part2.downcase
182
+ when 'caps' then part1.upcase + '_' + part2.upcase
183
+ else part1.downcase + '_' + part2.downcase
181
184
  end
182
185
  end
183
186
  end
184
187
 
185
188
  ############################
186
- def generate(module_name, pattern=nil)
187
-
189
+ def generate(module_name, pattern = nil)
188
190
  files = files_to_operate_on(module_name, pattern)
189
191
 
190
- #Abort if any module already exists
192
+ # Abort if all of the module files already exist
193
+ all_files_exist = true
191
194
  files.each do |file|
192
- raise "ERROR: File #{file[:name]} already exists. Exiting." if File.exist?(file[:path])
195
+ all_files_exist = false unless File.exist?(file[:path])
193
196
  end
197
+ raise "ERROR: File #{files[0][:name]} already exists. Exiting." if all_files_exist
194
198
 
195
199
  # Create Source Modules
196
- files.each_with_index do |file, i|
197
- FileUtils.mkdir_p(File.dirname(file[:path]), :verbose => false) # Create the path first if necessary.
200
+ files.each_with_index do |file, _i|
201
+ # If this file already exists, don't overwrite it.
202
+ if File.exist?(file[:path])
203
+ puts "File #{file[:path]} already exists!"
204
+ next
205
+ end
206
+ # Create the path first if necessary.
207
+ FileUtils.mkdir_p(File.dirname(file[:path]), verbose: false)
198
208
  File.open(file[:path], 'w') do |f|
199
209
  f.write("#{file[:boilerplate]}\n" % [file[:name]]) unless file[:boilerplate].nil?
200
- f.write(file[:template] % [ file[:name],
201
- file[:includes].map{|f| "#include \"#{f}\"\n"}.join,
202
- file[:name].upcase ]
203
- )
210
+ f.write(file[:template] % [file[:name],
211
+ file[:includes].map { |ff| "#include \"#{ff}\"\n" }.join,
212
+ file[:name].upcase])
204
213
  end
205
- if (@options[:update_svn])
214
+ if @options[:update_svn]
206
215
  `svn add \"#{file[:path]}\"`
207
- if $?.exitstatus == 0
216
+ if $!.exitstatus.zero?
208
217
  puts "File #{file[:path]} created and added to source control"
209
218
  else
210
219
  puts "File #{file[:path]} created but FAILED adding to source control!"
@@ -217,8 +226,7 @@ class UnityModuleGenerator
217
226
  end
218
227
 
219
228
  ############################
220
- def destroy(module_name, pattern=nil)
221
-
229
+ def destroy(module_name, pattern = nil)
222
230
  files_to_operate_on(module_name, pattern).each do |filespec|
223
231
  file = filespec[:path]
224
232
  if File.exist?(file)
@@ -233,66 +241,65 @@ class UnityModuleGenerator
233
241
  puts "File #{file} does not exist so cannot be removed."
234
242
  end
235
243
  end
236
- puts "Destroy Complete"
244
+ puts 'Destroy Complete'
237
245
  end
238
-
239
246
  end
240
247
 
241
248
  ############################
242
- #Handle As Command Line If Called That Way
243
- if ($0 == __FILE__)
249
+ # Handle As Command Line If Called That Way
250
+ if $0 == __FILE__
244
251
  destroy = false
245
- options = { }
252
+ options = {}
246
253
  module_name = nil
247
254
 
248
255
  # Parse the command line parameters.
249
256
  ARGV.each do |arg|
250
- case(arg)
251
- when /^-d/ then destroy = true
252
- when /^-u/ then options[:update_svn] = true
253
- when /^-p\"?(\w+)\"?/ then options[:pattern] = $1
254
- when /^-s\"?(.+)\"?/ then options[:path_src] = $1
255
- when /^-i\"?(.+)\"?/ then options[:path_inc] = $1
256
- when /^-t\"?(.+)\"?/ then options[:path_tst] = $1
257
- when /^-n\"?(.+)\"?/ then options[:naming] = $1
258
- when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config($1)
259
- when /^(\w+)/
260
- raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?
261
- module_name = arg
262
- when /^-(h|-help)/
263
- ARGV = []
264
- else
265
- raise "ERROR: Unknown option specified '#{arg}'"
257
+ case arg
258
+ when /^-d/ then destroy = true
259
+ when /^-u/ then options[:update_svn] = true
260
+ when /^-p\"?(\w+)\"?/ then options[:pattern] = Regexp.last_match(1)
261
+ when /^-s\"?(.+)\"?/ then options[:path_src] = Regexp.last_match(1)
262
+ when /^-i\"?(.+)\"?/ then options[:path_inc] = Regexp.last_match(1)
263
+ when /^-t\"?(.+)\"?/ then options[:path_tst] = Regexp.last_match(1)
264
+ when /^-n\"?(.+)\"?/ then options[:naming] = Regexp.last_match(1)
265
+ when /^-y\"?(.+)\"?/ then options = UnityModuleGenerator.grab_config(Regexp.last_match(1))
266
+ when /^(\w+)/
267
+ raise "ERROR: You can't have more than one Module name specified!" unless module_name.nil?
268
+ module_name = arg
269
+ when /^-(h|-help)/
270
+ ARGV = [].freeze
271
+ else
272
+ raise "ERROR: Unknown option specified '#{arg}'"
266
273
  end
267
274
  end
268
275
 
269
- if (!ARGV[0])
270
- puts [ "\nGENERATE MODULE\n-------- ------",
271
- "\nUsage: ruby generate_module [options] module_name",
272
- " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)",
273
- " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)",
274
- " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)",
275
- " -p\"MCH\" sets the output pattern to MCH.",
276
- " dh - driver hardware.",
277
- " dih - driver interrupt hardware.",
278
- " mch - model conductor hardware.",
279
- " mvp - model view presenter.",
280
- " src - just a source module, header and test. (DEFAULT)",
281
- " test - just a test file.",
282
- " -d destroy module instead of creating it.",
283
- " -n\"camel\" sets the file naming convention.",
284
- " bumpy - BumpyCaseFilenames.",
285
- " camel - camelCaseFilenames.",
286
- " snake - snake_case_filenames. (DEFAULT)",
287
- " caps - CAPS_CASE_FILENAMES.",
288
- " -u update subversion too (requires subversion command line)",
289
- " -y\"my.yml\" selects a different yaml config file for module generation",
290
- "" ].join("\n")
276
+ unless ARGV[0]
277
+ puts ["\nGENERATE MODULE\n-------- ------",
278
+ "\nUsage: ruby generate_module [options] module_name",
279
+ " -i\"include\" sets the path to output headers to 'include' (DEFAULT ../src)",
280
+ " -s\"../src\" sets the path to output source to '../src' (DEFAULT ../src)",
281
+ " -t\"C:/test\" sets the path to output source to 'C:/test' (DEFAULT ../test)",
282
+ ' -p"MCH" sets the output pattern to MCH.',
283
+ ' dh - driver hardware.',
284
+ ' dih - driver interrupt hardware.',
285
+ ' mch - model conductor hardware.',
286
+ ' mvp - model view presenter.',
287
+ ' src - just a source module, header and test. (DEFAULT)',
288
+ ' test - just a test file.',
289
+ ' -d destroy module instead of creating it.',
290
+ ' -n"camel" sets the file naming convention.',
291
+ ' bumpy - BumpyCaseFilenames.',
292
+ ' camel - camelCaseFilenames.',
293
+ ' snake - snake_case_filenames. (DEFAULT)',
294
+ ' caps - CAPS_CASE_FILENAMES.',
295
+ ' -u update subversion too (requires subversion command line)',
296
+ ' -y"my.yml" selects a different yaml config file for module generation',
297
+ ''].join("\n")
291
298
  exit
292
299
  end
293
300
 
294
- raise "ERROR: You must have a Module name specified! (use option -h for help)" if module_name.nil?
295
- if (destroy)
301
+ raise 'ERROR: You must have a Module name specified! (use option -h for help)' if module_name.nil?
302
+ if destroy
296
303
  UnityModuleGenerator.new(options).destroy(module_name)
297
304
  else
298
305
  UnityModuleGenerator.new(options).generate(module_name)