ceedling 0.31.0 → 0.31.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/assets/example_file_call.c +6 -0
  3. data/assets/example_file_call.h +6 -0
  4. data/assets/test_example_file_with_mock.c +13 -0
  5. data/bin/ceedling +2 -2
  6. data/ceedling.gemspec +1 -1
  7. data/lib/ceedling/configurator.rb +7 -2
  8. data/lib/ceedling/configurator_plugins.rb +21 -1
  9. data/lib/ceedling/defaults.rb +1 -0
  10. data/lib/ceedling/preprocessinator_extractor.rb +2 -0
  11. data/lib/ceedling/preprocessinator_includes_handler.rb +24 -24
  12. data/lib/ceedling/version.rb +11 -7
  13. data/plugins/gcov/config/defaults_gcov.rb +118 -0
  14. data/plugins/gcov/lib/gcovr_reportinator.rb +1 -1
  15. data/plugins/gcov/lib/reportgenerator_reportinator.rb +1 -1
  16. data/plugins/junit_tests_report/lib/junit_tests_report.rb +6 -6
  17. data/plugins/module_generator/README.md +16 -2
  18. data/plugins/module_generator/lib/module_generator.rb +1 -0
  19. data/spec/gcov/gcov_deployment_spec.rb +1 -1
  20. data/spec/preprocessinator_includes_handler_spec.rb +38 -8
  21. data/spec/spec_system_helper.rb +19 -0
  22. data/spec/system/deployment_spec.rb +1 -0
  23. data/vendor/cmock/lib/cmock_file_writer.rb +2 -3
  24. data/vendor/cmock/lib/cmock_generator.rb +87 -70
  25. data/vendor/cmock/lib/cmock_header_parser.rb +29 -27
  26. data/vendor/cmock/src/cmock.h +1 -1
  27. data/vendor/cmock/test/unit/cmock_generator_main_test.rb +46 -41
  28. data/vendor/cmock/test/unit/cmock_header_parser_test.rb +46 -40
  29. data/vendor/cmock/vendor/c_exception/README.md +6 -4
  30. data/vendor/cmock/vendor/c_exception/docs/CException.md +2 -2
  31. data/vendor/cmock/vendor/c_exception/lib/CException.h +1 -1
  32. data/vendor/cmock/vendor/c_exception/lib/meson.build +2 -2
  33. data/vendor/cmock/vendor/c_exception/meson.build +36 -2
  34. data/vendor/cmock/vendor/unity/README.md +77 -71
  35. data/vendor/cmock/vendor/unity/auto/generate_test_runner.rb +1 -1
  36. data/vendor/cmock/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +107 -126
  37. data/vendor/cmock/vendor/unity/docs/UnityAssertionsReference.md +149 -193
  38. data/vendor/cmock/vendor/unity/docs/UnityConfigurationGuide.md +236 -294
  39. data/vendor/cmock/vendor/unity/docs/UnityGettingStartedGuide.md +112 -121
  40. data/vendor/cmock/vendor/unity/docs/UnityHelperScriptsGuide.md +82 -115
  41. data/vendor/cmock/vendor/unity/extras/fixture/readme.md +16 -19
  42. data/vendor/cmock/vendor/unity/extras/memory/readme.md +27 -34
  43. data/vendor/cmock/vendor/unity/src/unity.c +1 -1
  44. data/vendor/cmock/vendor/unity/src/unity.h +1 -1
  45. data/vendor/cmock/vendor/unity/src/unity_internals.h +21 -7
  46. data/vendor/unity/README.md +77 -71
  47. data/vendor/unity/auto/generate_test_runner.rb +1 -1
  48. data/vendor/unity/docs/ThrowTheSwitchCodingStandard.md +107 -126
  49. data/vendor/unity/docs/UnityAssertionsReference.md +149 -193
  50. data/vendor/unity/docs/UnityConfigurationGuide.md +236 -294
  51. data/vendor/unity/docs/UnityGettingStartedGuide.md +112 -121
  52. data/vendor/unity/docs/UnityHelperScriptsGuide.md +82 -115
  53. data/vendor/unity/extras/fixture/readme.md +16 -19
  54. data/vendor/unity/extras/memory/readme.md +27 -34
  55. data/vendor/unity/src/unity.c +1 -1
  56. data/vendor/unity/src/unity.h +1 -1
  57. data/vendor/unity/src/unity_internals.h +21 -7
  58. metadata +14 -5
  59. data/plugins/gcov/config/defaults.yml +0 -55
@@ -2,123 +2,104 @@
2
2
 
3
3
  ## Welcome
4
4
 
5
- Congratulations. You're now the proud owner of your very own pile of bits! What
6
- are you going to do with all these ones and zeros? This document should be able
7
- to help you decide just that.
5
+ Congratulations.
6
+ You're now the proud owner of your very own pile of bits!
7
+ What are you going to do with all these ones and zeros?
8
+ This document should be able to help you decide just that.
8
9
 
9
- Unity is a unit test framework. The goal has been to keep it small and
10
- functional. The core Unity test framework is three files: a single C file and a
11
- couple header files. These team up to provide functions and macros to make
12
- testing easier.
13
-
14
- Unity was designed to be cross-platform. It works hard to stick with C standards
15
- while still providing support for the many embedded C compilers that bend the
16
- rules. Unity has been used with many compilers, including GCC, IAR, Clang,
17
- Green Hills, Microchip, and MS Visual Studio. It's not much work to get it to
18
- work with a new target.
10
+ Unity is a unit test framework.
11
+ The goal has been to keep it small and functional.
12
+ The core Unity test framework is three files: a single C file and a couple header files.
13
+ These team up to provide functions and macros to make testing easier.
19
14
 
15
+ Unity was designed to be cross-platform.
16
+ It works hard to stick with C standards while still providing support for the many embedded C compilers that bend the rules.
17
+ Unity has been used with many compilers, including GCC, IAR, Clang, Green Hills, Microchip, and MS Visual Studio.
18
+ It's not much work to get it to work with a new target.
20
19
 
21
20
  ### Overview of the Documents
22
21
 
23
22
  #### Unity Assertions reference
24
23
 
25
- This document will guide you through all the assertion options provided by
26
- Unity. This is going to be your unit testing bread and butter. You'll spend more
27
- time with assertions than any other part of Unity.
28
-
24
+ This document will guide you through all the assertion options provided by Unity.
25
+ This is going to be your unit testing bread and butter.
26
+ You'll spend more time with assertions than any other part of Unity.
29
27
 
30
28
  #### Unity Assertions Cheat Sheet
31
29
 
32
- This document contains an abridged summary of the assertions described in the
33
- previous document. It's perfect for printing and referencing while you
34
- familiarize yourself with Unity's options.
35
-
30
+ This document contains an abridged summary of the assertions described in the previous document.
31
+ It's perfect for printing and referencing while you familiarize yourself with Unity's options.
36
32
 
37
33
  #### Unity Configuration Guide
38
34
 
39
- This document is the one to reference when you are going to use Unity with a new
40
- target or compiler. It'll guide you through the configuration options and will
41
- help you customize your testing experience to meet your needs.
42
-
35
+ This document is the one to reference when you are going to use Unity with a new target or compiler.
36
+ It'll guide you through the configuration options and will help you customize your testing experience to meet your needs.
43
37
 
44
38
  #### Unity Helper Scripts
45
39
 
46
- This document describes the helper scripts that are available for simplifying
47
- your testing workflow. It describes the collection of optional Ruby scripts
48
- included in the auto directory of your Unity installation. Neither Ruby nor
49
- these scripts are necessary for using Unity. They are provided as a convenience
50
- for those who wish to use them.
51
-
40
+ This document describes the helper scripts that are available for simplifying your testing workflow.
41
+ It describes the collection of optional Ruby scripts included in the auto directory of your Unity installation.
42
+ Neither Ruby nor these scripts are necessary for using Unity.
43
+ They are provided as a convenience for those who wish to use them.
52
44
 
53
45
  #### Unity License
54
46
 
55
- What's an open source project without a license file? This brief document
56
- describes the terms you're agreeing to when you use this software. Basically, we
57
- want it to be useful to you in whatever context you want to use it, but please
58
- don't blame us if you run into problems.
59
-
47
+ What's an open source project without a license file?
48
+ This brief document describes the terms you're agreeing to when you use this software.
49
+ Basically, we want it to be useful to you in whatever context you want to use it, but please don't blame us if you run into problems.
60
50
 
61
51
  ### Overview of the Folders
62
52
 
63
- If you have obtained Unity through Github or something similar, you might be
64
- surprised by just how much stuff you suddenly have staring you in the face.
65
- Don't worry, Unity itself is very small. The rest of it is just there to make
66
- your life easier. You can ignore it or use it at your convenience. Here's an
67
- overview of everything in the project.
68
-
69
- - `src` - This is the code you care about! This folder contains a C file and two
70
- header files. These three files _are_ Unity.
71
- - `docs` - You're reading this document, so it's possible you have found your way
72
- into this folder already. This is where all the handy documentation can be
73
- found.
74
- - `examples` - This contains a few examples of using Unity.
75
- - `extras` - These are optional add ons to Unity that are not part of the core
76
- project. If you've reached us through James Grenning's book, you're going to
77
- want to look here.
78
- - `test` - This is how Unity and its scripts are all tested. If you're just using
79
- Unity, you'll likely never need to go in here. If you are the lucky team member
80
- who gets to port Unity to a new toolchain, this is a good place to verify
81
- everything is configured properly.
82
- - `auto` - Here you will find helpful Ruby scripts for simplifying your test
83
- workflow. They are purely optional and are not required to make use of Unity.
53
+ If you have obtained Unity through Github or something similar, you might be surprised by just how much stuff you suddenly have staring you in the face.
54
+ Don't worry, Unity itself is very small.
55
+ The rest of it is just there to make your life easier.
56
+ You can ignore it or use it at your convenience.
57
+ Here's an overview of everything in the project.
84
58
 
59
+ - `src` - This is the code you care about! This folder contains a C file and two header files.
60
+ These three files _are_ Unity.
61
+ - `docs` - You're reading this document, so it's possible you have found your way into this folder already.
62
+ This is where all the handy documentation can be found.
63
+ - `examples` - This contains a few examples of using Unity.
64
+ - `extras` - These are optional add ons to Unity that are not part of the core project.
65
+ If you've reached us through James Grenning's book, you're going to want to look here.
66
+ - `test` - This is how Unity and its scripts are all tested.
67
+ If you're just using Unity, you'll likely never need to go in here.
68
+ If you are the lucky team member who gets to port Unity to a new toolchain, this is a good place to verify everything is configured properly.
69
+ - `auto` - Here you will find helpful Ruby scripts for simplifying your test workflow.
70
+ They are purely optional and are not required to make use of Unity.
85
71
 
86
72
  ## How to Create A Test File
87
73
 
88
- Test files are C files. Most often you will create a single test file for each C
89
- module that you want to test. The test file should include unity.h and the
90
- header for your C module to be tested.
74
+ Test files are C files.
75
+ Most often you will create a single test file for each C module that you want to test.
76
+ The test file should include unity.h and the header for your C module to be tested.
91
77
 
92
- Next, a test file will include a `setUp()` and `tearDown()` function. The setUp
93
- function can contain anything you would like to run before each test. The
94
- tearDown function can contain anything you would like to run after each test.
95
- Both functions accept no arguments and return nothing. You may leave either or
96
- both of these blank if you have no need for them.
78
+ Next, a test file will include a `setUp()` and `tearDown()` function.
79
+ The setUp function can contain anything you would like to run before each test.
80
+ The tearDown function can contain anything you would like to run after each test.
81
+ Both functions accept no arguments and return nothing.
82
+ You may leave either or both of these blank if you have no need for them.
97
83
 
98
- If you're using Ceedling or the test runner generator script, you may leave these off
99
- completely. Not sure? Give it a try. If you compiler complains that it can't
100
- find setUp or tearDown when it links, you'll know you need to at least include
101
- an empty function for these.
84
+ If you're using Ceedling or the test runner generator script, you may leave these off completely.
85
+ Not sure?
86
+ Give it a try.
87
+ If your compiler complains that it can't find setUp or tearDown when it links, you'll know you need to at least include an empty function for these.
102
88
 
103
- The majority of the file will be a series of test functions. Test functions
104
- follow the convention of starting with the word "test_" or "spec_". You don't HAVE
105
- to name them this way, but it makes it clear what functions are tests for other
106
- developers. Also, the automated scripts that come with Unity or Ceedling will default
107
- to looking for test functions to be prefixed this way. Test functions take no arguments
108
- and return nothing. All test accounting is handled internally in Unity.
89
+ The majority of the file will be a series of test functions.
90
+ Test functions follow the convention of starting with the word "test_" or "spec_".
91
+ You don't HAVE to name them this way, but it makes it clear what functions are tests for other developers.
92
+ Also, the automated scripts that come with Unity or Ceedling will default to looking for test functions to be prefixed this way.
93
+ Test functions take no arguments and return nothing. All test accounting is handled internally in Unity.
109
94
 
110
95
  Finally, at the bottom of your test file, you will write a `main()` function.
111
- This function will call `UNITY_BEGIN()`, then `RUN_TEST` for each test, and
112
- finally `UNITY_END()`.This is what will actually trigger each of those test
113
- functions to run, so it is important that each function gets its own `RUN_TEST`
114
- call.
115
-
116
- Remembering to add each test to the main function can get to be tedious. If you
117
- enjoy using helper scripts in your build process, you might consider making use
118
- of our handy [generate_test_runner.rb](../auto/generate_test_runner.rb) script.
119
- This will create the main function and all the calls for you, assuming that you
120
- have followed the suggested naming conventions. In this case, there is no need
121
- for you to include the main function in your test file at all.
96
+ This function will call `UNITY_BEGIN()`, then `RUN_TEST` for each test, and finally `UNITY_END()`.
97
+ This is what will actually trigger each of those test functions to run, so it is important that each function gets its own `RUN_TEST` call.
98
+
99
+ Remembering to add each test to the main function can get to be tedious.
100
+ If you enjoy using helper scripts in your build process, you might consider making use of our handy [generate_test_runner.rb][] script.
101
+ This will create the main function and all the calls for you, assuming that you have followed the suggested naming conventions.
102
+ In this case, there is no need for you to include the main function in your test file at all.
122
103
 
123
104
  When you're done, your test file will look something like this:
124
105
 
@@ -156,24 +137,29 @@ For that sort of thing, you're going to want to look at the configuration guide.
156
137
  This should be enough to get you going, though.
157
138
 
158
139
  ### Running Test Functions
159
- When writing your own `main()` functions, for a test-runner. There are two ways
160
- to execute the test.
140
+
141
+ When writing your own `main()` functions, for a test-runner.
142
+ There are two ways to execute the test.
161
143
 
162
144
  The classic variant
145
+
163
146
  ``` c
164
147
  RUN_TEST(func, linenum)
165
148
  ```
166
- or its simpler replacement that starts at the beginning of the function.
149
+
150
+ Or its simpler replacement that starts at the beginning of the function.
151
+
167
152
  ``` c
168
153
  RUN_TEST(func)
169
154
  ```
170
- These macros perform the necessary setup before the test is called and
171
- handles cleanup and result tabulation afterwards.
155
+
156
+ These macros perform the necessary setup before the test is called and handles clean-up and result tabulation afterwards.
172
157
 
173
158
  ### Ignoring Test Functions
159
+
174
160
  There are times when a test is incomplete or not valid for some reason.
175
- At these times, TEST_IGNORE can be called. Control will immediately be
176
- returned to the caller of the test, and no failures will be returned.
161
+ At these times, TEST_IGNORE can be called.
162
+ Control will immediately be returned to the caller of the test, and no failures will be returned.
177
163
  This is useful when your test runners are automatically generated.
178
164
 
179
165
  ``` c
@@ -182,25 +168,35 @@ TEST_IGNORE()
182
168
 
183
169
  Ignore this test and return immediately
184
170
 
185
- ``` c
171
+ ```c
186
172
  TEST_IGNORE_MESSAGE (message)
187
173
  ```
188
174
 
189
- Ignore this test and return immediately. Output a message stating why the test was ignored.
175
+ Ignore this test and return immediately.
176
+ Output a message stating why the test was ignored.
190
177
 
191
178
  ### Aborting Tests
192
- There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test. A pair of macros support this functionality in Unity. The first `TEST_PROTECT` sets up the feature, and handles emergency abort cases. `TEST_ABORT` can then be used at any time within the tests to return to the last `TEST_PROTECT` call.
193
179
 
180
+ There are times when a test will contain an infinite loop on error conditions, or there may be reason to escape from the test early without executing the rest of the test.
181
+ A pair of macros support this functionality in Unity.
182
+ The first `TEST_PROTECT` sets up the feature, and handles emergency abort cases.
183
+ `TEST_ABORT` can then be used at any time within the tests to return to the last `TEST_PROTECT` call.
184
+
185
+ ```c
194
186
  TEST_PROTECT()
187
+ ```
195
188
 
196
189
  Setup and Catch macro
197
190
 
191
+ ```c
198
192
  TEST_ABORT()
193
+ ```
199
194
 
200
195
  Abort Test macro
201
196
 
202
197
  Example:
203
198
 
199
+ ```c
204
200
  main()
205
201
  {
206
202
  if (TEST_PROTECT())
@@ -208,44 +204,39 @@ Example:
208
204
  MyTest();
209
205
  }
210
206
  }
207
+ ```
211
208
 
212
209
  If MyTest calls `TEST_ABORT`, program control will immediately return to `TEST_PROTECT` with a return value of zero.
213
210
 
214
-
215
-
216
211
  ## How to Build and Run A Test File
217
212
 
218
- This is the single biggest challenge to picking up a new unit testing framework,
219
- at least in a language like C or C++. These languages are REALLY good at getting
220
- you "close to the metal" (why is the phrase metal? Wouldn't it be more accurate
221
- to say "close to the silicon"?). While this feature is usually a good thing, it
222
- can make testing more challenging.
213
+ This is the single biggest challenge to picking up a new unit testing framework, at least in a language like C or C++.
214
+ These languages are REALLY good at getting you "close to the metal" (why is the phrase metal? Wouldn't it be more accurate to say "close to the silicon"?).
215
+ While this feature is usually a good thing, it can make testing more challenging.
223
216
 
224
- You have two really good options for toolchains. Depending on where you're
225
- coming from, it might surprise you that neither of these options is running the
226
- unit tests on your hardware.
217
+ You have two really good options for toolchains.
218
+ Depending on where you're coming from, it might surprise you that neither of these options is running the unit tests on your hardware.
227
219
  There are many reasons for this, but here's a short version:
220
+
228
221
  - On hardware, you have too many constraints (processing power, memory, etc),
229
222
  - On hardware, you don't have complete control over all registers,
230
223
  - On hardware, unit testing is more challenging,
231
224
  - Unit testing isn't System testing. Keep them separate.
232
225
 
233
- Instead of running your tests on your actual hardware, most developers choose to
234
- develop them as native applications (using gcc or MSVC for example) or as
235
- applications running on a simulator. Either is a good option. Native apps have
236
- the advantages of being faster and easier to set up. Simulator apps have the
237
- advantage of working with the same compiler as your target application. The
238
- options for configuring these are discussed in the configuration guide.
226
+ Instead of running your tests on your actual hardware, most developers choose to develop them as native applications (using gcc or MSVC for example) or as applications running on a simulator.
227
+ Either is a good option.
228
+ Native apps have the advantages of being faster and easier to set up.
229
+ Simulator apps have the advantage of working with the same compiler as your target application.
230
+ The options for configuring these are discussed in the configuration guide.
239
231
 
240
- To get either to work, you might need to make a few changes to the file
241
- containing your register set (discussed later).
232
+ To get either to work, you might need to make a few changes to the file containing your register set (discussed later).
242
233
 
243
- In either case, a test is built by linking unity, the test file, and the C
244
- file(s) being tested. These files create an executable which can be run as the
245
- test set for that module. Then, this process is repeated for the next test file.
246
- This flexibility of separating tests into individual executables allows us to
247
- much more thoroughly unit test our system and it keeps all the test code out of
248
- our final release!
234
+ In either case, a test is built by linking unity, the test file, and the C file(s) being tested.
235
+ These files create an executable which can be run as the test set for that module.
236
+ Then, this process is repeated for the next test file.
237
+ This flexibility of separating tests into individual executables allows us to much more thoroughly unit test our system and it keeps all the test code out of our final release!
249
238
 
239
+ *Find The Latest of This And More at [ThrowTheSwitch.org][]*
250
240
 
251
- *Find The Latest of This And More at [ThrowTheSwitch.org](https://throwtheswitch.org)*
241
+ [generate_test_runner.rb]: ../auto/generate_test_runner.rb
242
+ [ThrowTheSwitch.org]: https://throwtheswitch.org
@@ -3,30 +3,25 @@
3
3
  ## With a Little Help From Our Friends
4
4
 
5
5
  Sometimes what it takes to be a really efficient C programmer is a little non-C.
6
- The Unity project includes a couple of Ruby scripts for making your life just a tad
7
- easier. They are completely optional. If you choose to use them, you'll need a
8
- copy of Ruby, of course. Just install whatever the latest version is, and it is
9
- likely to work. You can find Ruby at [ruby-lang.org](https://ruby-labg.org/).
10
-
6
+ The Unity project includes a couple of Ruby scripts for making your life just a tad easier.
7
+ They are completely optional.
8
+ If you choose to use them, you'll need a copy of Ruby, of course.
9
+ Just install whatever the latest version is, and it is likely to work. You can find Ruby at [ruby-lang.org][].
11
10
 
12
11
  ### `generate_test_runner.rb`
13
12
 
14
- Are you tired of creating your own `main` function in your test file? Do you
15
- keep forgetting to add a `RUN_TEST` call when you add a new test case to your
16
- suite? Do you want to use CMock or other fancy add-ons but don't want to figure
17
- out how to create your own `RUN_TEST` macro?
13
+ Are you tired of creating your own `main` function in your test file?
14
+ Do you keep forgetting to add a `RUN_TEST` call when you add a new test case to your suite?
15
+ Do you want to use CMock or other fancy add-ons but don't want to figure out how to create your own `RUN_TEST` macro?
18
16
 
19
17
  Well then we have the perfect script for you!
20
18
 
21
- The `generate_test_runner` script processes a given test file and automatically
22
- creates a separate test runner file that includes ?main?to execute the test
23
- cases within the scanned test file. All you do then is add the generated runner
24
- to your list of files to be compiled and linked, and presto you're done!
19
+ The `generate_test_runner` script processes a given test file and automatically creates a separate test runner file that includes ?main?to execute the test cases within the scanned test file.
20
+ All you do then is add the generated runner to your list of files to be compiled and linked, and presto you're done!
25
21
 
26
- This script searches your test file for void function signatures having a
27
- function name beginning with "test" or "spec". It treats each of these
28
- functions as a test case and builds up a test suite of them. For example, the
29
- following includes three test cases:
22
+ This script searches your test file for void function signatures having a function name beginning with "test" or "spec".
23
+ It treats each of these functions as a test case and builds up a test suite of them.
24
+ For example, the following includes three test cases:
30
25
 
31
26
  ```C
32
27
  void testVerifyThatUnityIsAwesomeAndWillMakeYourLifeEasier(void)
@@ -41,32 +36,30 @@ void spec_Function_should_DoWhatItIsSupposedToDo(void) {
41
36
  }
42
37
  ```
43
38
 
44
- You can run this script a couple of ways. The first is from the command line:
39
+ You can run this script a couple of ways.
40
+ The first is from the command line:
45
41
 
46
42
  ```Shell
47
43
  ruby generate_test_runner.rb TestFile.c NameOfRunner.c
48
44
  ```
49
45
 
50
- Alternatively, if you include only the test file parameter, the script will copy
51
- the name of the test file and automatically append `_Runner` to the name of the
52
- generated file. The example immediately below will create TestFile_Runner.c.
46
+ Alternatively, if you include only the test file parameter, the script will copy the name of the test file and automatically append `_Runner` to the name of the generated file.
47
+ The example immediately below will create TestFile_Runner.c.
53
48
 
54
49
  ```Shell
55
50
  ruby generate_test_runner.rb TestFile.c
56
51
  ```
57
52
 
58
- You can also add a [YAML](http://www.yaml.org/) file to configure extra options.
59
- Conveniently, this YAML file is of the same format as that used by Unity and
60
- CMock. So if you are using YAML files already, you can simply pass the very same
61
- file into the generator script.
53
+ You can also add a [YAML][] file to configure extra options.
54
+ Conveniently, this YAML file is of the same format as that used by Unity and CMock.
55
+ So if you are using YAML files already, you can simply pass the very same file into the generator script.
62
56
 
63
57
  ```Shell
64
58
  ruby generate_test_runner.rb TestFile.c my_config.yml
65
59
  ```
66
60
 
67
- The contents of the YAML file `my_config.yml` could look something like the
68
- example below. If you're wondering what some of these options do, you're going
69
- to love the next section of this document.
61
+ The contents of the YAML file `my_config.yml` could look something like the example below.
62
+ If you're wondering what some of these options do, you're going to love the next section of this document.
70
63
 
71
64
  ```YAML
72
65
  :unity:
@@ -74,23 +67,20 @@ to love the next section of this document.
74
67
  - stdio.h
75
68
  - microdefs.h
76
69
  :cexception: 1
77
- :suit_setup: "blah = malloc(1024);"
70
+ :suite_setup: "blah = malloc(1024);"
78
71
  :suite_teardown: "free(blah);"
79
72
  ```
80
73
 
81
- If you would like to force your generated test runner to include one or more
82
- header files, you can just include those at the command line too. Just make sure
83
- these are _after_ the YAML file, if you are using one:
74
+ If you would like to force your generated test runner to include one or more header files, you can just include those at the command line too.
75
+ Just make sure these are _after_ the YAML file, if you are using one:
84
76
 
85
77
  ```Shell
86
78
  ruby generate_test_runner.rb TestFile.c my_config.yml extras.h
87
79
  ```
88
80
 
89
- Another option, particularly if you are already using Ruby to orchestrate your
90
- builds - or more likely the Ruby-based build tool Rake - is requiring this
91
- script directly. Anything that you would have specified in a YAML file can be
92
- passed to the script as part of a hash. Let's push the exact same requirement
93
- set as we did above but this time through Ruby code directly:
81
+ Another option, particularly if you are already using Ruby to orchestrate your builds - or more likely the Ruby-based build tool Rake - is requiring this script directly.
82
+ Anything that you would have specified in a YAML file can be passed to the script as part of a hash.
83
+ Let's push the exact same requirement set as we did above but this time through Ruby code directly:
94
84
 
95
85
  ```Ruby
96
86
  require "generate_test_runner.rb"
@@ -103,9 +93,8 @@ options = {
103
93
  UnityTestRunnerGenerator.new.run(testfile, runner_name, options)
104
94
  ```
105
95
 
106
- If you have multiple files to generate in a build script (such as a Rakefile),
107
- you might want to instantiate a generator object with your options and call it
108
- to generate each runner afterwards. Like thus:
96
+ If you have multiple files to generate in a build script (such as a Rakefile), you might want to instantiate a generator object with your options and call it to generate each runner afterwards.
97
+ Like thus:
109
98
 
110
99
  ```Ruby
111
100
  gen = UnityTestRunnerGenerator.new(options)
@@ -114,70 +103,54 @@ test_files.each do |f|
114
103
  end
115
104
  ```
116
105
 
117
- #### Options accepted by generate_test_runner.rb:
118
-
119
- The following options are available when executing `generate_test_runner`. You
120
- may pass these as a Ruby hash directly or specify them in a YAML file, both of
121
- which are described above. In the `examples` directory, Example 3's Rakefile
122
- demonstrates using a Ruby hash.
106
+ #### Options accepted by generate_test_runner.rb
123
107
 
108
+ The following options are available when executing `generate_test_runner`.
109
+ You may pass these as a Ruby hash directly or specify them in a YAML file, both of which are described above.
110
+ In the `examples` directory, Example 3's Rakefile demonstrates using a Ruby hash.
124
111
 
125
112
  ##### `:includes`
126
113
 
127
- This option specifies an array of file names to be `#include`'d at the top of
128
- your runner C file. You might use it to reference custom types or anything else
129
- universally needed in your generated runners.
130
-
114
+ This option specifies an array of file names to be `#include`'d at the top of your runner C file.
115
+ You might use it to reference custom types or anything else universally needed in your generated runners.
131
116
 
132
117
  ##### `:suite_setup`
133
118
 
134
119
  Define this option with C code to be executed _before any_ test cases are run.
135
120
 
136
- Alternatively, if your C compiler supports weak symbols, you can leave this
137
- option unset and instead provide a `void suiteSetUp(void)` function in your test
138
- suite. The linker will look for this symbol and fall back to a Unity-provided
139
- stub if it is not found.
140
-
121
+ Alternatively, if your C compiler supports weak symbols, you can leave this option unset and instead provide a `void suiteSetUp(void)` function in your test suite.
122
+ The linker will look for this symbol and fall back to a Unity-provided stub if it is not found.
141
123
 
142
124
  ##### `:suite_teardown`
143
125
 
144
- Define this option with C code to be executed _after all_ test cases have
145
- finished. An integer variable `num_failures` is available for diagnostics.
146
- The code should end with a `return` statement; the value returned will become
147
- the exit code of `main`. You can normally just return `num_failures`.
148
-
149
- Alternatively, if your C compiler supports weak symbols, you can leave this
150
- option unset and instead provide a `int suiteTearDown(int num_failures)`
151
- function in your test suite. The linker will look for this symbol and fall
152
- back to a Unity-provided stub if it is not found.
126
+ Define this option with C code to be executed _after all_ test cases have finished.
127
+ An integer variable `num_failures` is available for diagnostics.
128
+ The code should end with a `return` statement; the value returned will become the exit code of `main`.
129
+ You can normally just return `num_failures`.
153
130
 
131
+ Alternatively, if your C compiler supports weak symbols, you can leave this option unset and instead provide a `int suiteTearDown(int num_failures)` function in your test suite.
132
+ The linker will look for this symbol and fall back to a Unity-provided stub if it is not found.
154
133
 
155
134
  ##### `:enforce_strict_ordering`
156
135
 
157
- This option should be defined if you have the strict order feature enabled in
158
- CMock (see CMock documentation). This generates extra variables required for
159
- everything to run smoothly. If you provide the same YAML to the generator as
160
- used in CMock's configuration, you've already configured the generator properly.
161
-
136
+ This option should be defined if you have the strict order feature enabled in CMock (see CMock documentation).
137
+ This generates extra variables required for everything to run smoothly.
138
+ If you provide the same YAML to the generator as used in CMock's configuration, you've already configured the generator properly.
162
139
 
163
140
  ##### `:externc`
164
141
 
165
- This option should be defined if you are mixing C and CPP and want your test
166
- runners to automatically include extern "C" support when they are generated.
142
+ This option should be defined if you are mixing C and CPP and want your test runners to automatically include extern "C" support when they are generated.
167
143
 
168
144
  ##### `:mock_prefix` and `:mock_suffix`
169
145
 
170
- Unity automatically generates calls to Init, Verify and Destroy for every file
171
- included in the main test file that starts with the given mock prefix and ends
172
- with the given mock suffix, file extension not included. By default, Unity
173
- assumes a `Mock` prefix and no suffix.
146
+ Unity automatically generates calls to Init, Verify and Destroy for every file included in the main test file that starts with the given mock prefix and ends with the given mock suffix, file extension not included.
147
+ By default, Unity assumes a `Mock` prefix and no suffix.
174
148
 
175
149
  ##### `:plugins`
176
150
 
177
- This option specifies an array of plugins to be used (of course, the array can
178
- contain only a single plugin). This is your opportunity to enable support for
179
- CException support, which will add a check for unhandled exceptions in each
180
- test, reporting a failure if one is detected. To enable this feature using Ruby:
151
+ This option specifies an array of plugins to be used (of course, the array can contain only a single plugin).
152
+ This is your opportunity to enable support for CException support, which will add a check for unhandled exceptions in each test, reporting a failure if one is detected.
153
+ To enable this feature using Ruby:
181
154
 
182
155
  ```Ruby
183
156
  :plugins => [ :cexception ]
@@ -190,57 +163,47 @@ Or as a yaml file:
190
163
  -:cexception
191
164
  ```
192
165
 
193
- If you are using CMock, it is very likely that you are already passing an array
194
- of plugins to CMock. You can just use the same array here. This script will just
195
- ignore the plugins that don't require additional support.
166
+ If you are using CMock, it is very likely that you are already passing an array of plugins to CMock.
167
+ You can just use the same array here.
168
+ This script will just ignore the plugins that don't require additional support.
196
169
 
197
170
  ##### `:include_extensions`
198
171
 
199
172
  This option specifies the pattern for matching acceptable header file extensions.
200
- By default it will accept hpp, hh, H, and h files. If you need a different combination
201
- of files to search, update this from the default `'(?:hpp|hh|H|h)'`.
173
+ By default it will accept hpp, hh, H, and h files.
174
+ If you need a different combination of files to search, update this from the default `'(?:hpp|hh|H|h)'`.
202
175
 
203
176
  ##### `:source_extensions`
204
177
 
205
178
  This option specifies the pattern for matching acceptable source file extensions.
206
- By default it will accept cpp, cc, C, c, and ino files. If you need a different combination
207
- of files to search, update this from the default `'(?:cpp|cc|ino|C|c)'`.
208
-
179
+ By default it will accept cpp, cc, C, c, and ino files.
180
+ If you need a different combination of files to search, update this from the default `'(?:cpp|cc|ino|C|c)'`.
209
181
 
210
182
  ### `unity_test_summary.rb`
211
183
 
212
- A Unity test file contains one or more test case functions. Each test case can
213
- pass, fail, or be ignored. Each test file is run individually producing results
214
- for its collection of test cases. A given project will almost certainly be
215
- composed of multiple test files. Therefore, the suite of tests is comprised of
216
- one or more test cases spread across one or more test files. This script
217
- aggregates individual test file results to generate a summary of all executed
218
- test cases. The output includes how many tests were run, how many were ignored,
219
- and how many failed. In addition, the output includes a listing of which
220
- specific tests were ignored and failed. A good example of the breadth and
221
- details of these results can be found in the `examples` directory. Intentionally
222
- ignored and failing tests in this project generate corresponding entries in the
223
- summary report.
224
-
225
- If you're interested in other (prettier?) output formats, check into the
226
- Ceedling build tool project (ceedling.sourceforge.net) that works with Unity and
227
- CMock and supports xunit-style xml as well as other goodies.
228
-
229
- This script assumes the existence of files ending with the extensions
230
- `.testpass` and `.testfail`.The contents of these files includes the test
231
- results summary corresponding to each test file executed with the extension set
232
- according to the presence or absence of failures for that test file. The script
233
- searches a specified path for these files, opens each one it finds, parses the
234
- results, and aggregates and prints a summary. Calling it from the command line
235
- looks like this:
184
+ A Unity test file contains one or more test case functions.
185
+ Each test case can pass, fail, or be ignored.
186
+ Each test file is run individually producing results for its collection of test cases.
187
+ A given project will almost certainly be composed of multiple test files.
188
+ Therefore, the suite of tests is comprised of one or more test cases spread across one or more test files.
189
+ This script aggregates individual test file results to generate a summary of all executed test cases.
190
+ The output includes how many tests were run, how many were ignored, and how many failed. In addition, the output includes a listing of which specific tests were ignored and failed.
191
+ A good example of the breadth and details of these results can be found in the `examples` directory.
192
+ Intentionally ignored and failing tests in this project generate corresponding entries in the summary report.
193
+
194
+ If you're interested in other (prettier?) output formats, check into the [Ceedling][] build tool project that works with Unity and CMock and supports xunit-style xml as well as other goodies.
195
+
196
+ This script assumes the existence of files ending with the extensions `.testpass` and `.testfail`.
197
+ The contents of these files includes the test results summary corresponding to each test file executed with the extension set according to the presence or absence of failures for that test file.
198
+ The script searches a specified path for these files, opens each one it finds, parses the results, and aggregates and prints a summary.
199
+ Calling it from the command line looks like this:
236
200
 
237
201
  ```Shell
238
202
  ruby unity_test_summary.rb build/test/
239
203
  ```
240
204
 
241
- You can optionally specify a root path as well. This is really helpful when you
242
- are using relative paths in your tools' setup, but you want to pull the summary
243
- into an IDE like Eclipse for clickable shortcuts.
205
+ You can optionally specify a root path as well.
206
+ This is really helpful when you are using relative paths in your tools' setup, but you want to pull the summary into an IDE like Eclipse for clickable shortcuts.
244
207
 
245
208
  ```Shell
246
209
  ruby unity_test_summary.rb build/test/ ~/projects/myproject/
@@ -274,5 +237,9 @@ OVERALL UNITY TEST SUMMARY
274
237
 
275
238
  How convenient is that?
276
239
 
240
+ *Find The Latest of This And More at [ThrowTheSwitch.org][]*
277
241
 
278
- *Find The Latest of This And More at [ThrowTheSwitch.org](https://throwtheswitch.org)*
242
+ [ruby-lang.org]: https://ruby-labg.org/
243
+ [YAML]: http://www.yaml.org/
244
+ [Ceedling]: http://www.throwtheswitch.org/ceedling
245
+ [ThrowTheSwitch.org]: https://throwtheswitch.org