135 Commits

Author SHA1 Message Date
31f5b47fc5 Add generator code to build file and make script executable 2021-04-04 01:54:43 +08:00
63fef7dd10 Enlarge the TEST_RANGE() regex to accept more spaces
This commit change the regex to accept more spaces inside the brackets
of the TEST_RANGE().

I use clang-format through vscode "editor.formatOnSave": true feature and it produce
padding spaces inside the array brackets by default.

```c
int a[] = [1, 2];
```

is changed into

```c
int a[] = [ 1, 2 ];
```

Also, every time I save a file containing a TEST_RANGE() with ctrl + s,
it breaks it.
2021-02-12 20:39:05 +01:00
c3afe99a77 parse mock files correctly 2020-08-27 13:21:45 +02:00
dcb30731f8 Fixed suiteTearDown not matching prototype
Fixed suiteTearDown to match prototype in unity.h
2020-05-04 20:34:45 +02:00
ff479e9aa0 Fix small typo 2020-03-28 18:31:43 +01:00
371e062555 Fixed issue #480 - better protection against bad pattern matching. 2020-03-17 16:24:25 -04:00
a67cb27dd4 Merge pull request #472 from jlindgren90/master
auto: Only create run_test() function if it's needed.
2020-03-17 15:35:47 -04:00
3e4dfec147 Add support for alternate forms of header and source files to test runner generator. This borrows heavily from #477 (Thanks @Tuc-an) but maintains the ability to sort files that don't need to be relinked. 2020-03-17 14:02:54 -04:00
218fa2cbe8 Add TEST_RANGE to specify arg ranges in parameterized tests
TEST_RANGE([start, stop, step]) generates following runs of the test
function: test(start), test(start + step), ..., test(start + n * step),
where start + n * step <= stop. The step must be positive.

If the test function takes several arguments, the following syntax must be used:
TEST_RANGE([arg1_start, arg1_stop, arg1_step], ..., [argN_start, argN_stop, argN_step])

This addresses issues #53 and #144.

Reported-by: Alex Rodriguez <alejmrm@gmail.com>
Reported-by: Hiroaki Yamazoe <PastelParasol@gmail.com>
2020-02-02 22:28:21 +03:00
f39c856a37 auto: Only create run_test() function if it's needed.
Also fix some whitespace consistency issues.
Use 2 newlines (not 1 or 3) before /*====Heading====*/ comments.
2019-12-12 12:53:49 -05:00
c5c36ab29f Do NOT include the default test runner if a custom runner has been defined.
Cleanup some style issues.
2019-12-05 13:19:43 -05:00
a303e08859 Option to omit UnityBegin/UnityEnd calls in generate_test_runner
By passing --omit_begin_end=1 to generate_test_runner.rb, the script
will now omit calls to UnityBegin and UnityEnd when running tests in a
suite.

This allows multiple suites to be executed in a row, and then have an overall
summary of the tests which were executed across all suites.
2019-10-29 20:32:06 +00:00
cf5b2d2568 Make verifyTest() leave Ignores and Callbacks intact. 2019-10-29 13:21:34 -04:00
be87d790c7 Add verifyTest option to go with resetTest.
Fix docs.
2019-10-28 10:32:22 -04:00
eb0bd42f0d Updated to newer coding standard 2019-10-24 15:33:41 -04:00
277e844bed Convert RUN_TEST() to a function (generated from an ERB template).
Converting RUN_TEST() from a macro to a function significantly reduces the size
of the compiled binary.  On amd64, the largest test runner in the test suite
(testsample_DefaultsThroughCommandLine_runner.o) was reduced from 3.4 kB to 2.4
kB (stripped).
2019-10-22 15:18:20 -04:00
d10cf6645d Remove unnecessary #includes. 2019-10-22 15:05:34 -04:00
68cc45a918 Make sure setUp/tearDown are always defined. 2019-10-22 15:04:03 -04:00
5fc72fbca1 fix name of teardown function 2019-10-22 06:52:25 -04:00
ff697ad29c suite setup and teardown no longer static (simplifies test-supplied instance) 2019-10-22 06:45:47 -04:00
ac427b28fc Fixed backwards case. 2019-10-22 06:37:28 -04:00
2d8a69e0d1 update handling of when suite_setup/teardown in use 2019-10-22 06:27:26 -04:00
cb8744c496 More argument fixing (I hate flying blind... can't wait to get back on my laptop) 2019-10-21 14:59:31 -04:00
c19e3f99ce missed function call arguments 2019-10-21 14:45:56 -04:00
d9b0edf282 Switch from the inconsistent use of weak symbols to handling setup, etc in script generators 2019-10-21 14:21:52 -04:00
2939c420ed Better protection against nested comments (and things that look like comments) 2019-08-12 15:40:43 -04:00
45020b0d3b Cleanup issue #417 2019-07-05 19:14:22 -04:00
f2d826c7c5 - Added options for how to handle TEST_ASSERT_EQUAL shorthand
- Tweak a couple style problems with Ruby scripts.
2019-07-03 15:03:03 -04:00
d70047881e Merge pull request #377 from elliot-gawthrop/execution-time-embedded
Execution time improvements
2019-05-04 07:53:37 -04:00
2697770ae9 Merge pull request #379 from elliot-gawthrop/auto-runner-args
Redefine name of resetTest in generated runner
2019-05-04 07:51:40 -04:00
2191b2ba8e Allow multi line test-function definitions. 2019-04-04 09:51:37 +02:00
076f0fff56 Improvements to the execution time feature
- Running time macros have been made more portable, previously it was not
  possible to override all macros
- Running time macros will be executed by default test runner, and auto test
  runners
- Adds a default execution time implementation for unix. (Previous default
  implementation only worked on Windows)
- For embedded platforms there is a simple method of getting a default
  implementation by defining a single macro UNITY_CLOCK_MS()
- Removed need for UNITY_EXEC_TIME_RESET. This was not being used for the default
  implementations, if anything ever did need reset-like functionality it could
  simply be wrapped up with the start or stop macros for that platform
2019-01-31 22:01:20 +00:00
145691519b Add ability to override name of the 'resetTest' function
This allows multiple groups to be compiled into the same executable by naming each function uniquely.
2019-01-31 21:59:58 +00:00
516f7be045 generate runner defines with #ifndef guards 2018-12-21 22:37:11 -05:00
5db2a3dbd9 Add support for strings in TEST_CASE() 2018-12-10 20:53:27 +00:00
6b657c6f17 Fix (most) Rubocop warnings. 2018-11-28 13:27:00 -05:00
9987824da7 Added support to inject "extern C" into runners when generated. 2018-08-09 08:48:08 -04:00
ceecf1fae8 Add support for :mock_suffix
Adds support for :mock_suffix when generating mock setup and teardown
functions. Also documents both prefix and suffix in the helper script
guide.
2018-06-07 10:06:43 +02:00
53f0f95ef8 Test runner generation: Wrap setjmp.h inclusion in ifdefs
Auto generated test runner should generate a code  which includes
setjmp.h only if UNITY_EXCLUDE_SETJMP_H is not defined
2017-11-20 09:46:30 +00:00
629b86d541 Merge unity_setup.h into unity.h. 2017-11-01 11:36:26 -04:00
df78aade4b Make weak symbol usage more portable:
- Enable support for Green Hills Software compiler
- Define weak implementations only once except on Windows
2017-10-09 11:39:48 -04:00
a7e8797e0c Fix link errors with MinGW.
MinGW supports a limited form of weak symbols, with the restriction
that weak/default implementations need to be defined in the same
translation unit they are called from.  Strong/overriding symbols
may of course be specified in a different translation unit.
2017-10-09 10:49:58 -04:00
2593c31bb7 Allow suiteSetUp() and suiteTearDown() to be provided as normal C functions.
This is simpler and more flexible than embedding C code in the Ruby options
(:suite_setup and :suite_teardown).  However, support for :suite_setup and
:suite_teardown is kept for backwards compatibility.

Several configurations are possible:
1. :suite_setup and :suite_teardown options provided and used.
2. :suite_setup and :suite_teardown options not provided (nil):
  2a. Weak symbols not supported; suiteSetUp() and suiteTearDown() are not called.
      It would be simpler to make user-provided functions mandatory in this case,
      but it could break some pre-existing test suites.
  2b. Weak symbols are supported and the stub implementations of suiteSetUp() and
      suiteTearDown() are called if there are no user-provided functions.
  2c. Weak symbols are supported but overridden by user-provided suiteSetUp() and
      suiteTearDown() functions.
2017-09-13 18:12:23 -04:00
f278c18fd9 Fix bug #288 - invalid line numbers on partial name matches 2017-09-11 15:39:17 -04:00
2a5b24f7bf Finished updating all Ruby scripts to match our coding standard. Woo! 2017-03-28 20:02:53 -04:00
3062c39725 Starting to enforce our coding style. The first step is that we’ve pulled in Rubocop to check out Ruby syntax. There is likely a bit of customization to do yet AND there is definitely that backlog of todo’s that we just told it to ignore. 2017-03-28 08:44:32 -04:00
c3658a065d Dropped support for pre-2.0 versions of Ruby (not even rubylang supports them anymore) 2017-03-20 16:07:40 -04:00
8a45ccf406 Use custom mock prefix when searching for mock header files. #263 2017-03-20 15:56:05 -04:00
689610b864 reorder includes in generated test runners 2017-03-20 15:49:28 -04:00
c67a4ffcf3 - Add ability to detect TEST_FILE(“filename.c”) specifications in test files 2017-03-13 17:23:26 -04:00