Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add test for dots in tag names

Commit
5eb7aa4f90fd3822adf1ba7a469b061af8bb2713
Author
Martin Hořeňovský ·
Parents
35cba5486d47

Files · Download .tar.gz

Changes

 tests/SelfTest/Baselines/automake.sw.approved.txt  |  1 +
 tests/SelfTest/Baselines/compact.sw.approved.txt   |  2 ++
 tests/SelfTest/Baselines/console.std.approved.txt  |  4 +--
 tests/SelfTest/Baselines/console.sw.approved.txt   | 20 +++++++++++++--
 tests/SelfTest/Baselines/junit.sw.approved.txt     |  3 ++-
 tests/SelfTest/Baselines/sonarqube.sw.approved.txt |  1 +
 tests/SelfTest/Baselines/tap.sw.approved.txt       |  6 ++++-
 tests/SelfTest/Baselines/teamcity.sw.approved.txt  |  2 ++
 tests/SelfTest/Baselines/xml.sw.approved.txt       | 29 ++++++++++++++++++----
 tests/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<has_operator> )
 :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:<line number>: passed: strlen(std::get<0>(data)) == static_
 Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6
 Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5
 Generators.tests.cpp:<line number>: passed: strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6
+Tag.tests.cpp:<line number>: passed: testcase->tags.size() == 1 for: 1 == 1
+Tag.tests.cpp:<line number>: passed: testcase->tags[0].original == "magic.tag"_catch_sr for: magic.tag == magic.tag
 Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'Why would you throw a std::string?'
 Misc.tests.cpp:<line number>: passed: result == "\"wide load\"" for: ""wide load"" == ""wide load""
 Misc.tests.cpp:<line number>: 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:<line number>: PASSED:
 with expansion:
   6 == 6
 
+-------------------------------------------------------------------------------
+tags with dots in later positions are not parsed as hidden
+-------------------------------------------------------------------------------
+Tag.tests.cpp:<line number>
+...............................................................................
+
+Tag.tests.cpp:<line number>: PASSED:
+  REQUIRE( testcase->tags.size() == 1 )
+with expansion:
+  1 == 1
+
+Tag.tests.cpp:<line number>: 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:<line number>
 Misc.tests.cpp:<line number>: 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 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuitesloose text artifact
 >
-  <testsuite name="<exe-name>" errors="17" failures="130" tests="2100" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="17" failures="130" tests="2102" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <properties>
       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
       <property name="random-seed" value="1"/>
@@ -1777,6 +1777,7 @@ Tricky.tests.cpp:<line number>
     <testcase classname="<exe-name>.global" name="stringify( vectors&lt;has_operator> )" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="strlen3" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="tables" time="{duration}" status="run"/>
+    <testcase classname="<exe-name>.global" name="tags with dots in later positions are not parsed as hidden" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="thrown std::strings are translated" time="{duration}" status="run">
       <error type="TEST_CASE">
 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 @@
     <testCase name="Tag alias can be registered against tag patterns/The same tag alias can only be registered once" duration="{duration}"/>
     <testCase name="Tag alias can be registered against tag patterns/Tag aliases must be of the form [@name]" duration="{duration}"/>
     <testCase name="shortened hide tags are split apart" duration="{duration}"/>
+    <testCase name="tags with dots in later positions are not parsed as hidden" duration="{duration}"/>
   </file>
   <file path="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp">
     <testCase name="Directly creating an EnumInfo" duration="{duration}"/>
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<size_t>(std::get<1>(
 ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5
 # tables
 ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(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:<line number>|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:<line number>|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
       </Expression>
       <OverallResult success="false"/>
     </TestCase>
-    <TestCase name="shortened hide tags are split apart" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
+    <TestCase name="shortened hide tags are split apart" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
       <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
         <Original>
           tags, VectorContains("magic-tag"_catch_sr) &amp;&amp; VectorContains("."_catch_sr)
@@ -18913,6 +18913,25 @@ loose text artifact
       </Expression>
       <OverallResult success="true"/>
     </TestCase>
+    <TestCase name="tags with dots in later positions are not parsed as hidden" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
+      <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
+        <Original>
+          testcase->tags.size() == 1
+        </Original>
+        <Expanded>
+          1 == 1
+        </Expanded>
+      </Expression>
+      <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
+        <Original>
+          testcase->tags[0].original == "magic.tag"_catch_sr
+        </Original>
+        <Expanded>
+          magic.tag == magic.tag
+        </Expanded>
+      </Expression>
+      <OverallResult success="true"/>
+    </TestCase>
     <TestCase name="thrown std::strings are translated" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
       <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
         Why would you throw a std::string?
@@ -19726,9 +19745,9 @@ loose text artifact
       </Section>
       <OverallResult success="true"/>
     </TestCase>
-    <OverallResults successes="1930" failures="147" expectedFailures="23"/>
-    <OverallResultsCases successes="267" failures="86" expectedFailures="6"/>
+    <OverallResults successes="1932" failures="147" expectedFailures="23"/>
+    <OverallResultsCases successes="268" failures="86" expectedFailures="6"/>
   </Group>
-  <OverallResults successes="1930" failures="146" expectedFailures="23"/>
-  <OverallResultsCases successes="267" failures="86" expectedFailures="6"/>
+  <OverallResults successes="1932" failures="146" expectedFailures="23"/>
+  <OverallResultsCases successes="268" failures="86" expectedFailures="6"/>
 </Catch>
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<StringRef> 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);
+}