Repository navigation
Commit 927eebb
committed
Keep braces in TEST_CASE arguments when finding tests
find_tests splits the scrubbed source into logical lines at every ;, {
and }. Braces inside string and character literals are already hidden
first, but braces in the argument list itself are not, so a compound
literal such as
TEST_CASE((uint8_t[]){0x1, 0x2}, 2)
void test_with_array(const uint8_t * data, unsigned len)
ends the logical line inside the TEST_CASE. The test is then found
without its arguments and the runner calls it as a plain void(void)
test, which modern GCC rejects with -Wincompatible-pointer-types.
Hide ;, {, } and / inside TEST_CASE/TEST_RANGE/TEST_MATRIX parentheses
the same way they are hidden inside literals, and restore them after
the split. Add a find_tests regression and a compound literal case to
test_unity_parameterized.c.
Fixes #7521 parent 2b80d1a commit 927eebb
4 files changed
Lines changed: 37 additions & 0 deletions
File tree
- auto
- docs
- test/tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
139 | 139 | | |
140 | 140 | | |
141 | 141 | | |
| 142 | + | |
142 | 143 | | |
143 | 144 | | |
144 | 145 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
22 | 23 | | |
23 | 24 | | |
24 | 25 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1383 | 1383 | | |
1384 | 1384 | | |
1385 | 1385 | | |
| 1386 | + | |
| 1387 | + | |
| 1388 | + | |
| 1389 | + | |
| 1390 | + | |
| 1391 | + | |
| 1392 | + | |
| 1393 | + | |
| 1394 | + | |
| 1395 | + | |
| 1396 | + | |
| 1397 | + | |
| 1398 | + | |
| 1399 | + | |
| 1400 | + | |
| 1401 | + | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
1386 | 1406 | | |
1387 | 1407 | | |
1388 | 1408 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
171 | 171 | | |
172 | 172 | | |
173 | 173 | | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
174 | 189 | | |
175 | 190 | | |
176 | 191 | | |
| |||
0 commit comments