diff options
| author | Martin Hořeňovský | 2020-04-12 18:44:42 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-05-01 09:56:34 +0200 |
| commit | 87a8b61d5a317ac99bbe35405d73ac7198ee51a8 (patch) | |
| tree | e36bb0d69e85a85fba6dffd7be96a4f588c85251 /tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp | |
| parent | ca27b0dcc5061b431d2082e6f344ee0e3525ac86 (diff) | |
| download | catch3-87a8b61d5a317ac99bbe35405d73ac7198ee51a8.tar.gz | |
Fix bug in test spec parser handling of escaping in ORed patterns
It did not clear out all of its internal state when switching from
one pattern to another, so when it should've escaped `,`, it took
its position from its position in the original user-provided string,
rather than its position in the current pattern.
Fixes #1905
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index 48a297b2..d78f8ac0 100644 --- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -296,6 +296,17 @@ TEST_CASE( "Parse test names and tags", "[command-line][test-spec]" ) { } } +TEST_CASE("#1905 -- test spec parser properly clears internal state between compound tests", "[command-line][test-spec]") { + using Catch::parseTestSpec; + using Catch::TestSpec; + // We ask for one of 2 different tests and the latter one of them has a , in name that needs escaping + TestSpec spec = parseTestSpec(R"("spec . char","spec \, char")"); + + REQUIRE(spec.matches(*fakeTestCase("spec . char"))); + REQUIRE(spec.matches(*fakeTestCase("spec , char"))); + REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)"))); +} + TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) { using namespace Catch::Matchers; |