Add test for dots in tag names

This commit is contained in:
Martin Hořeňovský 2021-05-12 21:43:14 +02:00
parent 35cba5486d
commit 5eb7aa4f90
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
10 changed files with 70 additions and 14 deletions

View File

@ -339,6 +339,7 @@ loose text artifact
:test-result: PASS stringify( vectors<has_operator> ) :test-result: PASS stringify( vectors<has_operator> )
:test-result: PASS strlen3 :test-result: PASS strlen3
:test-result: PASS tables :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: 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 const pointer returns the string contents
:test-result: PASS toString on const wchar_t pointer returns the string contents :test-result: PASS toString on const wchar_t pointer returns the string contents

View File

@ -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: 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: 5 == 5
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: 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?' 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""
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""

View File

@ -1386,6 +1386,6 @@ due to unexpected exception with message:
Why would you throw a std::string? Why would you throw a std::string?
=============================================================================== ===============================================================================
test cases: 359 | 283 passed | 70 failed | 6 failed as expected test cases: 360 | 284 passed | 70 failed | 6 failed as expected
assertions: 2082 | 1930 passed | 129 failed | 23 failed as expected assertions: 2084 | 1932 passed | 129 failed | 23 failed as expected

View File

@ -16046,6 +16046,22 @@ Generators.tests.cpp:<line number>: PASSED:
with expansion: with expansion:
6 == 6 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 thrown std::strings are translated
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -16766,6 +16782,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: PASSED: Misc.tests.cpp:<line number>: PASSED:
=============================================================================== ===============================================================================
test cases: 359 | 267 passed | 86 failed | 6 failed as expected test cases: 360 | 268 passed | 86 failed | 6 failed as expected
assertions: 2099 | 1930 passed | 146 failed | 23 failed as expected assertions: 2101 | 1932 passed | 146 failed | 23 failed as expected

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact <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> <properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/> <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="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="strlen3" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="tables" 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"> <testcase classname="<exe-name>.global" name="thrown std::strings are translated" time="{duration}" status="run">
<error type="TEST_CASE"> <error type="TEST_CASE">
FAILED: FAILED:

View File

@ -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/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="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="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>
<file path="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp"> <file path="tests/<exe-name>/IntrospectiveTests/ToString.tests.cpp">
<testCase name="Directly creating an EnumInfo" duration="{duration}"/> <testCase name="Directly creating an EnumInfo" duration="{duration}"/>

View File

@ -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 ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 5 == 5
# tables # tables
ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(data)) for: 6 == 6 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 # thrown std::strings are translated
not ok {test-number} - unexpected exception with message: 'Why would you throw a std::string?' 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 # 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} - ok {test-number} -
# xmlentitycheck # xmlentitycheck
ok {test-number} - ok {test-number} -
1..2099 1..2101

View File

@ -822,6 +822,8 @@ Tricky.tests.cpp:<line number>|nexpression failed|n REQUIRE( std::string( "firs
##teamcity[testFinished name='strlen3' duration="{duration}"] ##teamcity[testFinished name='strlen3' duration="{duration}"]
##teamcity[testStarted name='tables'] ##teamcity[testStarted name='tables']
##teamcity[testFinished name='tables' duration="{duration}"] ##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'] ##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?"'] 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}"] ##teamcity[testFinished name='thrown std::strings are translated' duration="{duration}"]

View File

@ -18499,7 +18499,7 @@ loose text artifact
</Expression> </Expression>
<OverallResult success="false"/> <OverallResult success="false"/>
</TestCase> </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" > <Expression success="true" type="REQUIRE_THAT" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
<Original> <Original>
tags, VectorContains("magic-tag"_catch_sr) &amp;&amp; VectorContains("."_catch_sr) tags, VectorContains("magic-tag"_catch_sr) &amp;&amp; VectorContains("."_catch_sr)
@ -18913,6 +18913,25 @@ loose text artifact
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </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" > <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" > <Exception filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
Why would you throw a std::string? Why would you throw a std::string?
@ -19726,9 +19745,9 @@ loose text artifact
</Section> </Section>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<OverallResults successes="1930" failures="147" expectedFailures="23"/> <OverallResults successes="1932" failures="147" expectedFailures="23"/>
<OverallResultsCases successes="267" failures="86" expectedFailures="6"/> <OverallResultsCases successes="268" failures="86" expectedFailures="6"/>
</Group> </Group>
<OverallResults successes="1930" failures="146" expectedFailures="23"/> <OverallResults successes="1932" failures="146" expectedFailures="23"/>
<OverallResultsCases successes="267" failures="86" expectedFailures="6"/> <OverallResultsCases successes="268" failures="86" expectedFailures="6"/>
</Catch> </Catch>

View File

@ -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::StringRef;
using Catch::Matchers::VectorContains; using Catch::Matchers::VectorContains;
auto testcase = Catch::makeTestCaseInfo("", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO); auto testcase = Catch::makeTestCaseInfo("", {"fake test name", "[.magic-tag]"}, CATCH_INTERNAL_LINEINFO);
// Transform ...
// Extract parsed tags into strings
std::vector<StringRef> tags; std::vector<StringRef> tags;
for (auto const& tag : testcase->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)); 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);
}