Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
diff options
context:
space:
mode:
authorMartin Hořeňovský2020-04-12 18:44:42 +0200
committerMartin Hořeňovský2020-05-01 09:56:34 +0200
commit87a8b61d5a317ac99bbe35405d73ac7198ee51a8 (patch)
treee36bb0d69e85a85fba6dffd7be96a4f588c85251 /tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
parentca27b0dcc5061b431d2082e6f344ee0e3525ac86 (diff)
downloadcatch3-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.cpp11
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;