221 Commits

Author SHA1 Message Date
6a8e03b5a9 Fix filename sanitization with command line option
When enabling the command line option the file name added to the runner
did not escape the slashes on windows in the same way other paths where
sanitized. Copied the sanitization from the other filename uses.
2023-04-17 18:23:20 +02:00
44bc9e6dbe Update Meson build system
The following features from the CMake build have been implemented:
 * Library version retrieved from unity.h.
 * Extension support.
 * Library, header, and package configuration file installation.

This commit is entirely based on existing work by Owen Torres.
2023-02-13 17:22:52 +01:00
5204c1bacf Merge pull request #550 from jannisbaudisch/fix_test_parameterization_regex
Improve regex for test parameterization to support function pointers
2023-02-06 15:31:49 -05:00
ae4ab78c47 Merge pull request #551 from pmembrey/add-meson-generator-for-test-runner
Enhance meson support so that it can automatically generate a test runner
2023-02-06 14:56:17 -05:00
67ca5c57c9 Merge pull request #556 from erijo/test-range-exclusive-end
Add support for TEST_RANGE with exclusive end
2022-11-12 20:46:33 -05:00
303e6ec81a Merge pull request #594 from LeoSebal/dev/python_JUnit_fix
Fixes and features on the JUnit Python conversion script
2022-11-12 20:42:55 -05:00
7e332fb9a9 Merge pull request #598 from AJIOB/parse_output_color_support
Parse output color & time support with custom test suite name
2022-11-12 20:42:07 -05:00
563786f97c Add support for TEST_RANGE with exclusive end
If the range is <start, end, step> instead of [start, end, step], the
end value will not be included in the range.

This can be useful if you have a define that defines e.g. the size of
something and you want to use this define as the end value. As the
pre-processor doesn't evalutate expressions (unless you do some macro
magic) you can't specify the range as [0, MY_SIZE - 1, 1]. With this
change you can then instead give the range <0, MY_SIZE, 1>.
2022-10-14 18:51:45 +02:00
76b7e359cc Improve handling of space in TEST_CASE/RANGE
The fix in 285bb6e282 didn't completly fix the issue.
2022-10-13 22:13:03 +02:00
37b61d2be2 Merge pull request #555 from erijo/test-case-space
Ignore space around parameter in TEST_CASE()
2022-10-11 16:25:05 -04:00
de73f1fcbf Merge pull request #554 from erijo/single-test-range
Make TEST_RANGE handle a single range
2022-10-04 21:57:38 -04:00
5dd3aa40dc Fix call to ERB.new to avoid deprecation warnings.
On later Rubies calling create_run_test() causes the generation of warnings of the following form:

warning: Passing safe_level with the 2nd argument of ERB.new is deprecated...
warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated...

This patch removes the noise.
2022-05-28 12:35:22 +01:00
b44c2dd095 Fix broken YAML parsing on later Rubies with Psych >=4.0
YAML.load is now interpreted as YAML.safe_load, which breaks where the
YAML file contains aliases. If we can assume our yaml files are
trusted (since this a development tool), we can check for the presence
of YAML.unsafe_load and use it instead if it exists.
2022-05-27 15:08:11 +01:00
824eb5f5c5 Fixing Rubocop code style 2022-02-28 16:59:52 +03:00
2dbfd0594c Adding time feature description 2022-02-28 16:11:32 +03:00
42503b3343 unity_to_junit.py can be imported as Python module now 2022-02-28 14:12:57 +03:00
32608af4f5 Test passing time will be in seconds now
(for xml output)

(cherry picked from commit 39d54e2913b0c3a18106a13705fed2fb8ab7f4b0)
2022-02-28 14:06:59 +03:00
edf6a52bfd Test time parsing was added
(cherry picked from commit f2fe9fd4ad78c574af08afaa91d402b37464b131)
2022-02-28 14:06:53 +03:00
72f30d82e4 Add missing volatile type qualifier
... to fix "clobbered variable" compiler warning (`-Wclobbered`).
2022-02-21 14:10:10 +01:00
cc36e0d82b Fix failed & ignored tests color parsing 2022-02-16 15:18:38 +03:00
5089be60e0 parse_output accepting all symbols now
Methods with their args can contain colons (':') now
2022-02-16 15:18:38 +03:00
e32809c529 Trying to fix errors of non-ASCII characters while parsing 2022-02-16 15:18:38 +03:00
474d201800 parse_output: test names can contain double-quoted string now 2022-02-16 15:18:38 +03:00
10d593d413 parse_output test_suite tag can be passed as arg now 2022-02-16 15:18:38 +03:00
2b725883f7 parse_output should parse color output now 2022-02-16 15:18:38 +03:00
2ad5d74dc7 Fixes and features on the JUnit Python conversion script
* Added python3 shebang
* Renamed the script `unity_to_junit.py` as `stylize_as_junit.py`
  to match the Ruby file
* Fixed a bug on where the script failed if the first entry slot of
  each result line is empty. Now falls back to the result file name
* Rewrote the argument parsing to use argparse
* Added a `--output` / `-o` option, to match the Ruby file
2022-01-19 18:50:54 +01:00
285bb6e282 Ignore space around parameter in TEST_CASE()
This makes it possible to use defines that expand to something that
includes space, e.g. TEST_CASE(true).
2021-12-03 17:35:51 +01:00
72ffe691cd Make TEST_RANGE handle a single range
Before this change a single range such as TEST_RANGE([5, 100, 5]) would
generate the following error:

undefined method `flatten' for 5:Integer (NoMethodError)

The problem is that reduce called on an array with a single element
returns that element which isn't an array of arrays as expected by the
following block.
2021-12-03 17:33:56 +01:00
93850fab40 Merge pull request #557 from erijo/unit-tests
Fix failing unit tests
2021-12-03 10:55:39 -05:00
29617c7ecd Added -externcincludes option in order to build unit test executable in mixed C/C++ environment 2021-07-15 13:10:07 +02:00
8e1e9c18ab Fix ruby style warnings as reported by rubocop 2021-04-15 22:22:33 +02:00
31f5b47fc5 Add generator code to build file and make script executable 2021-04-04 01:54:43 +08:00
b51303a65b Improve regex for test parameterization to support function pointers
The regex to match function names for the test parameterization used the
wildcard '.*'. This lead to an error when you try to add a function
pointer as arguement.

The regex will now only match the word characters a-z A-Z 0-9 and
underscore (which are all characers that are accepted by the C standard)
2021-04-01 10:29:22 +02: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
0b899aec14 Fix conditional issue in generator script.
Bump version.
2021-01-26 08:59:27 -05:00
fcab680286 Ruby script cleanup.
Fix warnings.
Remove 32-bit tests from standard suite because they're not running on most platforms.
2021-01-16 21:03:18 -05:00
038dd81213 Merge pull request #520 from softwareinmotion/runner_mock_suffix
parse mock files correctly
2021-01-07 18:08:09 -05:00
76c3755fe3 Add guard TEST on test module template
With a test file guarded we can include this file on IDE project
(MPLAB X in my case) and compile without excluding test files.
Excluding test files on MPLAB X disable autocompletion and function
navigation.
2020-09-07 10:37:26 +02:00
c3afe99a77 parse mock files correctly 2020-08-27 13:21:45 +02:00
f5ff3504b5 auto/run_test: fix Wsign-compare warning
Compiling a source base / test with Wsign-compare enabled, gives
the following warning:

build/test/runners/test_system_runner.c: In function ‘run_test’:
build/test/runners/test_system_runner.c:62:35: warning: conversion to ‘UNITY_UINT’ {aka ‘long unsigned int’} from ‘int’ may change the sign of the result [-Wsign-conversion]
   62 |     Unity.CurrentTestLineNumber = line_num;
      |                                   ^~~~~~~~

Fix by updating the type in the function declaration.

Signed-off-by: André Draszik <git@andred.net>
2020-05-25 07:14:14 +01: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
2c3e75e859 Fixed issue #486 2020-03-17 20:38:11 -04: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
3b5b491860 sub in '_' for '-' in define and test name in module generator 2019-12-26 01:10:09 -05: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