diff options
| author | Martin Hořeňovský | 2026-08-08 14:59:04 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2026-08-10 00:17:26 +0200 |
| commit | 630840c5000ec9f5e169c8a2f5fd163d3b0c54ca (patch) | |
| tree | df4e6a4290688c37120a1b6fd3b520ec8ce9a741 /tests/TestScripts/DiscoverTests/register-tests.cpp | |
| parent | 4cde12851773b32fc5a0171f262e4281c8e28b01 (diff) | |
| download | catch3-630840c5000ec9f5e169c8a2f5fd163d3b0c54ca.tar.gz | |
Fix <target>_TESTS variable generated by `catch_discover_tests`
There were 2 separate bugs, one recently added and one ancient
(since roughly the first version of the registration script).
1) The recent refactoring of how the JSON output from Catch2 is
parsed caused shadowing between the variable containing the
per-test JSON fragments and the accumulator of test names for
<target>_TESTS variable. This led to the variable containing
both the names and the JSON fragments, and thus being completely
wrong.
2) The test name accumulation has never accounted for characters
that need escaping to be present in a CMake list. This means
that e.g. test names with semicolon in them would end up with
two elements in the test list.
Both of these are now fixed, at the cost of extra complexity and
my sanity as I had to learn more about CMake escaping rules.
(CMake escaping rules are dumb)
Diffstat (limited to 'tests/TestScripts/DiscoverTests/register-tests.cpp')
| -rw-r--r-- | tests/TestScripts/DiscoverTests/register-tests.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tests/TestScripts/DiscoverTests/register-tests.cpp b/tests/TestScripts/DiscoverTests/register-tests.cpp index b833dba2..e22b9752 100644 --- a/tests/TestScripts/DiscoverTests/register-tests.cpp +++ b/tests/TestScripts/DiscoverTests/register-tests.cpp @@ -40,7 +40,11 @@ public: TEST_CASE_METHOD(TestCaseFixture, "A test case as method", "[tagstagstags]") {} +TEST_CASE("Unclosed right ) parenthesis") {} +TEST_CASE("Unclosed left ( parenthesis") {} + TEST_CASE( "Newlines\nAnd\rOther\n\tWhitespace", "[whitespace-going-wild]" ) {} +TEST_CASE( "Escaped \\n newline and \\r other whitespace", "[whitespace-going-wild]") {} // Some JSON-like and JSON-adjacent characters and substrings in the test names/tags // This serves to test that the parse-json-via-string-splitting hack in |