mirror of
https://github.com/catchorg/Catch2.git
synced 2025-01-15 14:48:00 +00:00
Compare commits
3 Commits
c9371865d4
...
e6da4e10ae
Author | SHA1 | Date | |
---|---|---|---|
|
e6da4e10ae | ||
|
816f69416b | ||
|
aee31d0620 |
@ -1165,7 +1165,7 @@ namespace Catch {
|
||||
makeTestCaseInfo(std::string const& _className,
|
||||
NameAndTags const& nameAndTags,
|
||||
SourceLineInfo const& _lineInfo ) {
|
||||
return Detail::unique_ptr<TestCaseInfo>(new TestCaseInfo(_className, nameAndTags, _lineInfo));
|
||||
return Detail::make_unique<TestCaseInfo>(_className, nameAndTags, _lineInfo);
|
||||
}
|
||||
|
||||
TestCaseInfo::TestCaseInfo(std::string const& _className,
|
||||
|
@ -146,6 +146,7 @@ namespace Catch {
|
||||
// it over to backing storage and actually reference the
|
||||
// backing storage in the saved tags
|
||||
StringRef tagStr = originalTags.substr(tagStart+1, tagEnd - tagStart - 1);
|
||||
CATCH_ENFORCE(!tagStr.empty(), "Empty tags are not allowed");
|
||||
enforceNotReservedTag(tagStr, lineInfo);
|
||||
properties |= parseSpecialTag(tagStr);
|
||||
// When copying a tag to the backing storage, we need to
|
||||
|
@ -282,6 +282,7 @@ Message from section two
|
||||
:test-result: PASS classify_outliers
|
||||
:test-result: PASS comparisons between const int variables
|
||||
:test-result: PASS comparisons between int variables
|
||||
:test-result: PASS empty tags are not allowed
|
||||
:test-result: PASS erfc_inv
|
||||
:test-result: PASS estimate_clock_resolution
|
||||
:test-result: PASS even more nested SECTION tests
|
||||
|
@ -2065,6 +2065,7 @@ Condition.tests.cpp:<line number>: passed: long_var == unsigned_char_var for: 1
|
||||
Condition.tests.cpp:<line number>: passed: long_var == unsigned_short_var for: 1 == 1
|
||||
Condition.tests.cpp:<line number>: passed: long_var == unsigned_int_var for: 1 == 1
|
||||
Condition.tests.cpp:<line number>: passed: long_var == unsigned_long_var for: 1 == 1
|
||||
Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo)
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.103560) == Approx(-0.09203687623843015) for: -0.0920368762 == Approx( -0.0920368762 )
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(1.067400) == Approx(-0.05980291115763361) for: -0.0598029112 == Approx( -0.0598029112 )
|
||||
InternalBenchmark.tests.cpp:<line number>: passed: erfc_inv(0.050000) == Approx(1.38590382434967796) for: 1.3859038243 == Approx( 1.3859038243 )
|
||||
@ -2262,8 +2263,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
|
||||
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""
|
||||
|
@ -1386,6 +1386,6 @@ due to unexpected exception with message:
|
||||
Why would you throw a std::string?
|
||||
|
||||
===============================================================================
|
||||
test cases: 364 | 288 passed | 70 failed | 6 failed as expected
|
||||
assertions: 2091 | 1939 passed | 129 failed | 23 failed as expected
|
||||
test cases: 365 | 289 passed | 70 failed | 6 failed as expected
|
||||
assertions: 2092 | 1940 passed | 129 failed | 23 failed as expected
|
||||
|
||||
|
@ -14597,6 +14597,15 @@ Condition.tests.cpp:<line number>: PASSED:
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
empty tags are not allowed
|
||||
-------------------------------------------------------------------------------
|
||||
Tag.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE_THROWS( Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo) )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
erfc_inv
|
||||
-------------------------------------------------------------------------------
|
||||
@ -16114,12 +16123,12 @@ Tag.tests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( testcase->tags.size() == 1 )
|
||||
REQUIRE( testcase.tags.size() == 1 )
|
||||
with expansion:
|
||||
1 == 1
|
||||
|
||||
Tag.tests.cpp:<line number>: PASSED:
|
||||
REQUIRE( testcase->tags[0].original == "magic.tag"_catch_sr )
|
||||
REQUIRE( testcase.tags[0].original == "magic.tag"_catch_sr )
|
||||
with expansion:
|
||||
magic.tag == magic.tag
|
||||
|
||||
@ -16843,6 +16852,6 @@ Misc.tests.cpp:<line number>
|
||||
Misc.tests.cpp:<line number>: PASSED:
|
||||
|
||||
===============================================================================
|
||||
test cases: 364 | 272 passed | 86 failed | 6 failed as expected
|
||||
assertions: 2108 | 1939 passed | 146 failed | 23 failed as expected
|
||||
test cases: 365 | 273 passed | 86 failed | 6 failed as expected
|
||||
assertions: 2109 | 1940 passed | 146 failed | 23 failed as expected
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<testsuitesloose text artifact
|
||||
>
|
||||
<testsuite name="<exe-name>" errors="17" failures="130" tests="2109" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<testsuite name="<exe-name>" errors="17" failures="130" tests="2110" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
|
||||
<properties>
|
||||
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
|
||||
<property name="random-seed" value="1"/>
|
||||
@ -1548,6 +1548,7 @@ Misc.tests.cpp:<line number>
|
||||
<testcase classname="<exe-name>.global" name="classify_outliers/mixed" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="comparisons between const int variables" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="comparisons between int variables" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="empty tags are not allowed" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="erfc_inv" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="estimate_clock_resolution" time="{duration}" status="run"/>
|
||||
<testcase classname="<exe-name>.global" name="even more nested SECTION tests/c/d (leaf)" time="{duration}" status="run"/>
|
||||
|
@ -216,6 +216,7 @@
|
||||
<file path="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp">
|
||||
<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="empty tags are not allowed" 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>
|
||||
|
@ -3703,6 +3703,8 @@ ok {test-number} - long_var == unsigned_short_var for: 1 == 1
|
||||
ok {test-number} - long_var == unsigned_int_var for: 1 == 1
|
||||
# comparisons between int variables
|
||||
ok {test-number} - long_var == unsigned_long_var for: 1 == 1
|
||||
# empty tags are not allowed
|
||||
ok {test-number} - Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo)
|
||||
# erfc_inv
|
||||
ok {test-number} - erfc_inv(1.103560) == Approx(-0.09203687623843015) for: -0.0920368762 == Approx( -0.0920368762 )
|
||||
# erfc_inv
|
||||
@ -4041,9 +4043,9 @@ ok {test-number} - strlen(std::get<0>(data)) == static_cast<size_t>(std::get<1>(
|
||||
# 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
|
||||
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
|
||||
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
|
||||
@ -4218,5 +4220,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
|
||||
ok {test-number} -
|
||||
# xmlentitycheck
|
||||
ok {test-number} -
|
||||
1..2108
|
||||
1..2109
|
||||
|
||||
|
@ -690,6 +690,8 @@ Misc.tests.cpp:<line number>|nexpression failed|n REQUIRE( testCheckedIf( false
|
||||
##teamcity[testFinished name='comparisons between const int variables' duration="{duration}"]
|
||||
##teamcity[testStarted name='comparisons between int variables']
|
||||
##teamcity[testFinished name='comparisons between int variables' duration="{duration}"]
|
||||
##teamcity[testStarted name='empty tags are not allowed']
|
||||
##teamcity[testFinished name='empty tags are not allowed' duration="{duration}"]
|
||||
##teamcity[testStarted name='erfc_inv']
|
||||
##teamcity[testFinished name='erfc_inv' duration="{duration}"]
|
||||
##teamcity[testStarted name='estimate_clock_resolution']
|
||||
|
@ -17257,6 +17257,17 @@ There is no extra whitespace here
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="empty tags are not allowed" tags="[tags]" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
|
||||
<Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
|
||||
<Original>
|
||||
Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo)
|
||||
</Original>
|
||||
<Expanded>
|
||||
Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo)
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="erfc_inv" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" >
|
||||
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" >
|
||||
<Original>
|
||||
@ -18986,7 +18997,7 @@ loose text artifact
|
||||
<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
|
||||
testcase.tags.size() == 1
|
||||
</Original>
|
||||
<Expanded>
|
||||
1 == 1
|
||||
@ -18994,7 +19005,7 @@ loose text artifact
|
||||
</Expression>
|
||||
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
|
||||
<Original>
|
||||
testcase->tags[0].original == "magic.tag"_catch_sr
|
||||
testcase.tags[0].original == "magic.tag"_catch_sr
|
||||
</Original>
|
||||
<Expanded>
|
||||
magic.tag == magic.tag
|
||||
@ -19815,9 +19826,9 @@ loose text artifact
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="1939" failures="147" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="272" failures="86" expectedFailures="6"/>
|
||||
<OverallResults successes="1940" failures="147" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="273" failures="86" expectedFailures="6"/>
|
||||
</Group>
|
||||
<OverallResults successes="1939" failures="146" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="272" failures="86" expectedFailures="6"/>
|
||||
<OverallResults successes="1940" failures="146" expectedFailures="23"/>
|
||||
<OverallResultsCases successes="273" failures="86" expectedFailures="6"/>
|
||||
</Catch>
|
||||
|
@ -39,14 +39,17 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) {
|
||||
}
|
||||
}
|
||||
|
||||
// Dummy line info for creating dummy test cases below
|
||||
constexpr Catch::SourceLineInfo dummySourceLineInfo = CATCH_INTERNAL_LINEINFO;
|
||||
|
||||
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);
|
||||
Catch::TestCaseInfo testcase("", {"fake test name", "[.magic-tag]"}, dummySourceLineInfo);
|
||||
|
||||
// Extract parsed tags into strings
|
||||
std::vector<StringRef> tags;
|
||||
for (auto const& tag : testcase->tags) {
|
||||
for (auto const& tag : testcase.tags) {
|
||||
tags.push_back(tag.lowerCased);
|
||||
}
|
||||
REQUIRE_THAT(tags, VectorContains("magic-tag"_catch_sr) && VectorContains("."_catch_sr));
|
||||
@ -55,8 +58,14 @@ TEST_CASE("shortened hide tags are split apart", "[tags]") {
|
||||
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);
|
||||
Catch::TestCaseInfo testcase("", { "fake test name", "[magic.tag]" }, dummySourceLineInfo);
|
||||
|
||||
REQUIRE(testcase->tags.size() == 1);
|
||||
REQUIRE(testcase->tags[0].original == "magic.tag"_catch_sr);
|
||||
REQUIRE(testcase.tags.size() == 1);
|
||||
REQUIRE(testcase.tags[0].original == "magic.tag"_catch_sr);
|
||||
}
|
||||
|
||||
TEST_CASE( "empty tags are not allowed", "[tags]" ) {
|
||||
REQUIRE_THROWS(
|
||||
Catch::TestCaseInfo("", { "test with an empty tag", "[]" }, dummySourceLineInfo)
|
||||
);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user