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-17 21:16:18 +0200
committerMartin Hořeňovský2020-05-02 18:24:07 +0200
commitdd35430a2b03265343846735593fdc519cd64418 (patch)
tree6e74c4df4acf065c869f2703317363a1a10bb704 /tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
parentbbbc7a0d7fdc301d5f9f917426d62827927ca916 (diff)
downloadcatch3-dd35430a2b03265343846735593fdc519cd64418.tar.gz
Add more tests for test spec parser
Originally the tests were from #1912, but as it turned out, the issue was somewhere else. Still, the inputs provided were interesting, so they are now part of our test suite.
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index d78f8ac0..e8bf6e5f 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -307,6 +307,24 @@ TEST_CASE("#1905 -- test spec parser properly clears internal state between comp
REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)")));
}
+TEST_CASE("#1912 -- test spec parser handles escaping", "[command-line][test-spec]") {
+ using Catch::parseTestSpec;
+ using Catch::TestSpec;
+
+ SECTION("Various parentheses") {
+ TestSpec spec = parseTestSpec(R"(spec {a} char,spec \[a] char)");
+
+ REQUIRE(spec.matches(*fakeTestCase(R"(spec {a} char)")));
+ REQUIRE(spec.matches(*fakeTestCase(R"(spec [a] char)")));
+ REQUIRE_FALSE(spec.matches(*fakeTestCase("differs but has similar tag", "[a]")));
+ }
+ SECTION("backslash in test name") {
+ TestSpec spec = parseTestSpec(R"(spec \\ char)");
+
+ REQUIRE(spec.matches(*fakeTestCase(R"(spec \ char)")));
+ }
+}
+
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
using namespace Catch::Matchers;