From 5eb7aa4f90fd3822adf1ba7a469b061af8bb2713 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Wed, 12 May 2021 21:43:14 +0200 Subject: [PATCH] Add test for dots in tag names --- .../Baselines/automake.sw.approved.txt | 1 + .../Baselines/compact.sw.approved.txt | 2 ++ .../Baselines/console.std.approved.txt | 4 +-- .../Baselines/console.sw.approved.txt | 20 +++++++++++-- .../SelfTest/Baselines/junit.sw.approved.txt | 3 +- .../Baselines/sonarqube.sw.approved.txt | 1 + tests/SelfTest/Baselines/tap.sw.approved.txt | 6 +++- .../Baselines/teamcity.sw.approved.txt | 2 ++ tests/SelfTest/Baselines/xml.sw.approved.txt | 29 +++++++++++++++---- .../SelfTest/IntrospectiveTests/Tag.tests.cpp | 16 ++++++++-- 10 files changed, 70 insertions(+), 14 deletions(-) diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index c4ad5b1e..588ab112 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -339,6 +339,7 @@ loose text artifact :test-result: PASS stringify( vectors ) :test-result: PASS strlen3 :test-result: PASS tables +:test-result: PASS tags with dots in later positions are not parsed as hidden :test-result: FAIL thrown std::strings are translated :test-result: PASS toString on const wchar_t const pointer returns the string contents :test-result: PASS toString on const wchar_t pointer returns the string contents diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 92488f5f..c846bbb3 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -2253,6 +2253,8 @@ Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_ Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 6 == 6 Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 5 == 5 Generators.tests.cpp:: passed: strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 6 == 6 +Tag.tests.cpp:: passed: testcase->tags.size() == 1 for: 1 == 1 +Tag.tests.cpp:: passed: testcase->tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag Exception.tests.cpp:: failed: unexpected exception with message: 'Why would you throw a std::string?' Misc.tests.cpp:: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" Misc.tests.cpp:: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load"" diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index d9e8f2b8..316fedd1 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1386,6 +1386,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 359 | 283 passed | 70 failed | 6 failed as expected -assertions: 2082 | 1930 passed | 129 failed | 23 failed as expected +test cases: 360 | 284 passed | 70 failed | 6 failed as expected +assertions: 2084 | 1932 passed | 129 failed | 23 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 7e53a539..9570aecb 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -16046,6 +16046,22 @@ Generators.tests.cpp:: PASSED: with expansion: 6 == 6 +------------------------------------------------------------------------------- +tags with dots in later positions are not parsed as hidden +------------------------------------------------------------------------------- +Tag.tests.cpp: +............................................................................... + +Tag.tests.cpp:: PASSED: + REQUIRE( testcase->tags.size() == 1 ) +with expansion: + 1 == 1 + +Tag.tests.cpp:: PASSED: + REQUIRE( testcase->tags[0].original == "magic.tag"_catch_sr ) +with expansion: + magic.tag == magic.tag + ------------------------------------------------------------------------------- thrown std::strings are translated ------------------------------------------------------------------------------- @@ -16766,6 +16782,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 359 | 267 passed | 86 failed | 6 failed as expected -assertions: 2099 | 1930 passed | 146 failed | 23 failed as expected +test cases: 360 | 268 passed | 86 failed | 6 failed as expected +assertions: 2101 | 1932 passed | 146 failed | 23 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index d90b1645..dada5c30 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -1777,6 +1777,7 @@ Tricky.tests.cpp: + FAILED: diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index b900a55c..8c1873f2 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -217,6 +217,7 @@ + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index a6e63f6d..a615c103 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -4026,6 +4026,10 @@ ok {test-number} - strlen(std::get<0>(data)) == static_cast(std::get<1>( ok {test-number} - strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 5 == 5 # tables ok {test-number} - strlen(std::get<0>(data)) == static_cast(std::get<1>(data)) for: 6 == 6 +# tags with dots in later positions are not parsed as hidden +ok {test-number} - testcase->tags.size() == 1 for: 1 == 1 +# tags with dots in later positions are not parsed as hidden +ok {test-number} - testcase->tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag # thrown std::strings are translated not ok {test-number} - unexpected exception with message: 'Why would you throw a std::string?' # toString on const wchar_t const pointer returns the string contents @@ -4200,5 +4204,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2099 +1..2101 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 2c1a8c5c..1eaa89ee 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -822,6 +822,8 @@ Tricky.tests.cpp:|nexpression failed|n REQUIRE( std::string( "firs ##teamcity[testFinished name='strlen3' duration="{duration}"] ##teamcity[testStarted name='tables'] ##teamcity[testFinished name='tables' duration="{duration}"] +##teamcity[testStarted name='tags with dots in later positions are not parsed as hidden'] +##teamcity[testFinished name='tags with dots in later positions are not parsed as hidden' duration="{duration}"] ##teamcity[testStarted name='thrown std::strings are translated'] Exception.tests.cpp:|nunexpected exception with message:|n "Why would you throw a std::string?"'] ##teamcity[testFinished name='thrown std::strings are translated' duration="{duration}"] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 4aecb91e..c0807418 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -18499,7 +18499,7 @@ loose text artifact - + tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr) @@ -18913,6 +18913,25 @@ loose text artifact + + + + testcase->tags.size() == 1 + + + 1 == 1 + + + + + testcase->tags[0].original == "magic.tag"_catch_sr + + + magic.tag == magic.tag + + + + Why would you throw a std::string? @@ -19726,9 +19745,9 @@ loose text artifact - - + + - - + + diff --git a/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp b/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp index 15d37c98..44b82c6c 100644 --- a/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/Tag.tests.cpp @@ -39,14 +39,24 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) { } } -TEST_CASE("shortened hide tags are split apart") { +TEST_CASE("shortened hide tags are split apart", "[tags]") { using Catch::StringRef; using Catch::Matchers::VectorContains; auto testcase = Catch::makeTestCaseInfo("", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO); - // Transform ... + + // Extract parsed tags into strings std::vector tags; for (auto const& tag : testcase->tags) { - tags.push_back(tag.original); + tags.push_back(tag.lowerCased); } REQUIRE_THAT(tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr)); } + +TEST_CASE("tags with dots in later positions are not parsed as hidden", "[tags]") { + using Catch::StringRef; + using Catch::Matchers::VectorContains; + auto testcase = Catch::makeTestCaseInfo("", { "fake test name", "[magic.tag]" }, CATCH_INTERNAL_LINEINFO); + + REQUIRE(testcase->tags.size() == 1); + REQUIRE(testcase->tags[0].original == "magic.tag"_catch_sr); +}