diff --git a/include/internal/catch_test_case_info.cpp b/include/internal/catch_test_case_info.cpp index 716c0b4b..cee972fa 100644 --- a/include/internal/catch_test_case_info.cpp +++ b/include/internal/catch_test_case_info.cpp @@ -89,7 +89,8 @@ namespace Catch { } } if( isHidden ) { - tags.emplace_back( "." ); + // Add all "hidden" tags to make them behave identically + tags.insert( tags.end(), { ".", "!hide" } ); } TestCaseInfo info( static_cast(nameAndTags.name), _className, desc, tags, _lineInfo ); diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index a74faf9b..8bfe5ee6 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -1567,6 +1567,9 @@ Xml.tests.cpp:: passed: encode( stringWithQuotes, Catch::XmlEncode: "don't "quote" me on that" Xml.tests.cpp:: passed: encode( "[\x01]" ) == "[\\x01]" for: "[\x01]" == "[\x01]" Xml.tests.cpp:: passed: encode( "[\x7F]" ) == "[\\x7F]" for: "[\x7F]" == "[\x7F]" +Tag.tests.cpp:: passed: testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) for: { "!hide", "." } ( Contains: "." and Contains: "!hide" ) +Tag.tests.cpp:: passed: testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) for: { "!hide", "." } ( Contains: "." and Contains: "!hide" ) +Tag.tests.cpp:: passed: testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) for: { "!hide", ".", "foo" } ( Contains: "." and Contains: "!hide" ) ToStringVector.tests.cpp:: passed: Catch::Detail::stringify( empty ) == "{ }" for: "{ }" == "{ }" ToStringVector.tests.cpp:: passed: Catch::Detail::stringify( oneValue ) == "{ 42 }" for: "{ 42 }" == "{ 42 }" ToStringVector.tests.cpp:: passed: Catch::Detail::stringify( twoValues ) == "{ 42, 250 }" for: "{ 42, 250 }" == "{ 42, 250 }" @@ -1668,7 +1671,7 @@ StringManip.tests.cpp:: passed: Catch::replaceInPlace(s, "'", "|'") StringManip.tests.cpp:: passed: s == "didn|'t" for: "didn|'t" == "didn|'t" Misc.tests.cpp:: failed: false with 1 message: '3' Message.tests.cpp:: failed: false with 2 messages: 'hi' and 'i := 7' -Tag.tests.cpp:: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) +Tag.tests.cpp:: passed: testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) for: { "!hide", ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) StringManip.tests.cpp:: passed: splitStringRef("", ','), Equals(std::vector()) for: { } Equals: { } StringManip.tests.cpp:: passed: splitStringRef("abc", ','), Equals(std::vector{"abc"}) for: { abc } Equals: { abc } StringManip.tests.cpp:: passed: splitStringRef("abc,def", ','), Equals(std::vector{"abc", "def"}) for: { abc, def } Equals: { abc, def } diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 4db2b90a..41322425 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -1380,6 +1380,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 304 | 230 passed | 70 failed | 4 failed as expected -assertions: 1659 | 1507 passed | 131 failed | 21 failed as expected +test cases: 305 | 231 passed | 70 failed | 4 failed as expected +assertions: 1662 | 1510 passed | 131 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 8de4bcaa..1cc78936 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -11465,6 +11465,39 @@ Xml.tests.cpp:: PASSED: with expansion: "[\x7F]" == "[\x7F]" +------------------------------------------------------------------------------- +adding a hide tag implicitly enables all others +------------------------------------------------------------------------------- +Tag.tests.cpp: +............................................................................... + +Tag.tests.cpp:: PASSED: + REQUIRE_THAT( testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) ) +with expansion: + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + +------------------------------------------------------------------------------- +adding a hide tag implicitly enables all others +------------------------------------------------------------------------------- +Tag.tests.cpp: +............................................................................... + +Tag.tests.cpp:: PASSED: + REQUIRE_THAT( testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) ) +with expansion: + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + +------------------------------------------------------------------------------- +adding a hide tag implicitly enables all others +------------------------------------------------------------------------------- +Tag.tests.cpp: +............................................................................... + +Tag.tests.cpp:: PASSED: + REQUIRE_THAT( testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) ) +with expansion: + { "!hide", ".", "foo" } ( Contains: "." and Contains: "!hide" ) + ------------------------------------------------------------------------------- array -> toString ------------------------------------------------------------------------------- @@ -12387,7 +12420,7 @@ Tag.tests.cpp: Tag.tests.cpp:: PASSED: REQUIRE_THAT( testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) ) with expansion: - { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) + { "!hide", ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) ------------------------------------------------------------------------------- splitString @@ -13251,6 +13284,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 304 | 214 passed | 86 failed | 4 failed as expected -assertions: 1676 | 1507 passed | 148 failed | 21 failed as expected +test cases: 305 | 215 passed | 86 failed | 4 failed as expected +assertions: 1679 | 1510 passed | 148 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 41065c4e..d32809ff 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -1404,6 +1404,7 @@ Exception.tests.cpp: + diff --git a/projects/SelfTest/Baselines/sonarqube.sw.approved.txt b/projects/SelfTest/Baselines/sonarqube.sw.approved.txt index f1b9fe98..47dabc2b 100644 --- a/projects/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/projects/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -142,6 +142,7 @@ + diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index cf7413e3..55c160a2 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -113,7 +113,7 @@ - + @@ -161,7 +161,7 @@ - + This info message starts with a linebreak @@ -172,7 +172,7 @@ This warning message starts with a linebreak - + 1514 @@ -196,7 +196,7 @@ Nor would this - +
answer := 42 @@ -309,7 +309,7 @@ Nor would this - + f() == 0 @@ -342,7 +342,7 @@ Nor would this - +
@@ -360,7 +360,7 @@ Nor would this
- + false != false @@ -1227,7 +1227,7 @@ Nor would this - + s == "world" @@ -1249,7 +1249,7 @@ Nor would this - + Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1260,7 +1260,7 @@ Nor would this - + Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1271,7 +1271,7 @@ Nor would this - + Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1282,7 +1282,7 @@ Nor would this - + Template_Fixture_2<TestType>::m_a.size() == 1 @@ -1337,7 +1337,7 @@ Nor would this - + Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1348,7 +1348,7 @@ Nor would this - + Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1359,7 +1359,7 @@ Nor would this - + Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1370,7 +1370,7 @@ Nor would this - + Template_Fixture_2<TestType>{}.m_a.size() < 2 @@ -1425,7 +1425,7 @@ Nor would this - + Template_Fixture<TestType>::m_a == 2 @@ -1436,7 +1436,7 @@ Nor would this - + Template_Fixture<TestType>::m_a == 2 @@ -1447,7 +1447,7 @@ Nor would this - + Template_Fixture<TestType>::m_a == 2 @@ -1491,7 +1491,7 @@ Nor would this - + Nttp_Fixture<V>::value == 0 @@ -1502,7 +1502,7 @@ Nor would this - + Nttp_Fixture<V>::value == 0 @@ -1513,7 +1513,7 @@ Nor would this - + Nttp_Fixture<V>::value == 0 @@ -1557,7 +1557,7 @@ Nor would this - + m_a == 2 @@ -1718,7 +1718,7 @@ Nor would this - +
@@ -1730,7 +1730,7 @@ Nor would this - + &o1 == &o2 @@ -1822,7 +1822,7 @@ Nor would this - + 1 == 1 @@ -2832,7 +2832,7 @@ Nor would this - + testStringForMatching(), Contains("not there", Catch::CaseSensitive::No) @@ -3005,7 +3005,7 @@ Nor would this
- + throwCustom() @@ -3019,7 +3019,7 @@ Nor would this - + throwCustom(), std::exception @@ -3033,7 +3033,7 @@ Nor would this - + custom std exception @@ -3087,7 +3087,7 @@ Nor would this - + testStringForMatching(), EndsWith("Substring") @@ -3181,7 +3181,7 @@ Nor would this - + data.int_seven == 6 @@ -3366,7 +3366,7 @@ Nor would this - + testStringForMatching(), Equals("this string contains 'ABC' as a substring") @@ -3416,7 +3416,7 @@ Nor would this - +
@@ -3596,7 +3596,7 @@ Nor would this - + thisThrows(), std::string @@ -3629,17 +3629,17 @@ Nor would this - + This is a failure - + - + This is a failure @@ -6865,7 +6865,7 @@ Nor would this - + this is a message @@ -6874,7 +6874,7 @@ Nor would this - + this message should be logged @@ -6891,7 +6891,7 @@ Nor would this - + this message may be logged later @@ -6956,7 +6956,7 @@ Nor would this - + current counter 0 @@ -7113,7 +7113,7 @@ Nor would this - + data.int_seven != 7 @@ -7326,7 +7326,7 @@ Nor would this - + testStringForMatching(), (Contains("string") || Contains("different")) && Contains("random") @@ -7348,7 +7348,7 @@ Nor would this - + testStringForMatching(), !Contains("substring") @@ -7359,7 +7359,7 @@ Nor would this - + thisThrows(), "expected exception" @@ -7509,13 +7509,13 @@ Nor would this - + This one ran - + custom exception @@ -7551,7 +7551,7 @@ Nor would this - + data.int_seven > 7 @@ -8004,7 +8004,7 @@ Nor would this
- +
Message from section one @@ -10218,7 +10218,7 @@ Nor would this - + truthy(false) @@ -10229,7 +10229,7 @@ Nor would this - + testStringForMatching(), Matches("this STRING contains 'abc' as a substring") @@ -10270,7 +10270,7 @@ Nor would this - + @@ -10438,7 +10438,7 @@ Nor would this
- + A string sent directly to stdout @@ -10516,7 +10516,7 @@ A string sent to stderr via clog - +
@@ -10530,7 +10530,7 @@ Message from section two
- + testStringForMatching(), StartsWith("This String") @@ -11115,7 +11115,7 @@ Message from section two - + s1 == s2 @@ -12584,10 +12584,10 @@ Message from section two - + - + For some reason someone is throwing a string literal! @@ -13251,7 +13251,7 @@ There is no extra whitespace here - + 3.14 @@ -13410,7 +13410,7 @@ There is no extra whitespace here
- +
@@ -13565,7 +13565,7 @@ There is no extra whitespace here
- +
@@ -13703,13 +13703,13 @@ There is no extra whitespace here - + unexpected exception - + thisThrows() == 0 @@ -13723,7 +13723,7 @@ There is no extra whitespace here - + thisThrows() == 0 @@ -13737,7 +13737,7 @@ There is no extra whitespace here - + thisThrows() == 0 @@ -13751,7 +13751,7 @@ There is no extra whitespace here - +
unexpected exception @@ -13763,13 +13763,13 @@ There is no extra whitespace here - + Uncomment the code in this test to check that it gives a sensible compiler error - + Uncomment the code in this test to check that it gives a sensible compiler error @@ -13900,6 +13900,33 @@ There is no extra whitespace here
+ + + + testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) + + + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + + + + + testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) + + + { "!hide", "." } ( Contains: "." and Contains: "!hide" ) + + + + + testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide")) + + + { "!hide", ".", "foo" } ( Contains: "." and Contains: "!hide" ) + + + + @@ -13968,7 +13995,7 @@ There is no extra whitespace here - + flag @@ -14006,7 +14033,7 @@ There is no extra whitespace here - + flag @@ -14120,13 +14147,13 @@ There is no extra whitespace here loose text artifact - + Previous info should not be seen - + previous unscoped info SHOULD not be seen @@ -14151,7 +14178,7 @@ loose text artifact - +
@@ -14264,7 +14291,7 @@ loose text artifact
- + Testing if fib[0] (1) is even @@ -14376,7 +14403,7 @@ loose text artifact - +
@@ -14421,7 +14448,7 @@ loose text artifact
- +
@@ -14465,7 +14492,7 @@ loose text artifact - + ti == typeid(int) @@ -14479,7 +14506,7 @@ loose text artifact - + this MAY be seen only for the FIRST assertion IF info is printed for passing assertions @@ -14651,7 +14678,7 @@ loose text artifact - + this SHOULD be seen @@ -14668,7 +14695,7 @@ loose text artifact - + this SHOULD be seen only ONCE @@ -14709,7 +14736,7 @@ loose text artifact - +
@@ -14881,7 +14908,7 @@ loose text artifact - + 3 @@ -14895,7 +14922,7 @@ loose text artifact - + hi @@ -14918,7 +14945,7 @@ loose text artifact testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string(".")) - { ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) + { "!hide", ".", "magic-tag" } ( Contains: "magic-tag" and Contains: "." ) @@ -14950,7 +14977,7 @@ loose text artifact - + Count 1 to 3... @@ -15104,7 +15131,7 @@ loose text artifact - + std::string( "first" ) == "second" @@ -15326,7 +15353,7 @@ loose text artifact - + Why would you throw a std::string? @@ -15844,7 +15871,7 @@ loose text artifact
- + - + diff --git a/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp b/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp index 27958223..ae911444 100644 --- a/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp +++ b/projects/SelfTest/IntrospectiveTests/Tag.tests.cpp @@ -45,3 +45,10 @@ TEST_CASE("shortened hide tags are split apart") { auto testcase = Catch::makeTestCase(nullptr, "", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO); REQUIRE_THAT(testcase.tags, Catch::VectorContains(std::string("magic-tag")) && Catch::VectorContains(std::string("."))); } + +TEST_CASE("adding a hide tag implicitly enables all others", "[tags]") { + using Catch::VectorContains; + auto tag = GENERATE(as{}, "[!hide]", "[.]", "[.foo]"); + auto testcase = Catch::makeTestCase(nullptr, "", {"fake test name", tag}, CATCH_INTERNAL_LINEINFO); + REQUIRE_THAT(testcase.tags, VectorContains(std::string(".")) && VectorContains(std::string("!hide"))); +}