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ý2019-11-05 23:28:47 +0100
committerMartin Hořeňovský2020-02-13 13:35:10 +0100
commitc50ba09cdef4e9d8764868a1a67f0ec3850b5d04 (patch)
tree0612abe0b87c85be5109f7445cbaaf09cc784b71 /tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
parentc165bd15c5017137db38e149c8c8b68f1233fa96 (diff)
downloadcatch3-c50ba09cdef4e9d8764868a1a67f0ec3850b5d04.tar.gz
Split [.foo] into [.][foo] when parsing test specs
b77cec05c0 fixed this problem for tagging tests, so that a test case tagged with `[.foo]` would be parsed as tagged with `[.][foo]`. This does the same for the test spec parsing. Fixes #1798
Diffstat (limited to 'tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp')
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index bff30f2c..68dafad1 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -19,7 +19,7 @@ namespace {
auto fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCaseInfo("", { name, desc }, CATCH_INTERNAL_LINEINFO); }
}
-TEST_CASE( "Parse test names and tags" ) {
+TEST_CASE( "Parse test names and tags", "[command-line][test-spec]" ) {
using Catch::parseTestSpec;
using Catch::TestSpec;
@@ -280,7 +280,18 @@ TEST_CASE( "Parse test names and tags" ) {
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) );
-
+ }
+ SECTION("Shortened hide tags are split apart when parsing") {
+ TestSpec spec = parseTestSpec("[.foo]");
+ CHECK(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")));
+ CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]")));
+ }
+ SECTION("Shortened hide tags also properly handle exclusion") {
+ TestSpec spec = parseTestSpec("~[.foo]");
+ CHECK_FALSE(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")));
+ CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]")));
+ CHECK_FALSE(spec.matches(*fakeTestCase("only hidden", "[.]")));
+ CHECK(spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")));
}
}