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.
This commit is contained in:
Martin Hořeňovský
2020-04-17 21:16:18 +02:00
parent bbbc7a0d7f
commit dd35430a2b
11 changed files with 156 additions and 10 deletions

View File

@@ -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;