diff options
| author | Martin Hořeňovský | 2020-04-17 21:16:18 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2020-05-02 18:24:07 +0200 |
| commit | dd35430a2b03265343846735593fdc519cd64418 (patch) | |
| tree | 6e74c4df4acf065c869f2703317363a1a10bb704 /tests/SelfTest/IntrospectiveTests | |
| parent | bbbc7a0d7fdc301d5f9f917426d62827927ca916 (diff) | |
| download | catch3-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')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp | 18 |
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; |