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
Covered more translation possibilities
- Commit
f988b4eb352d1ae627abde0933b9674142300080- Author
- Martin Hořeňovský ·
- Parents
c8d765a57508
Changes
.../SelfTest/Baselines/compact.sw.approved.txt | 4 +++- .../SelfTest/Baselines/console.std.approved.txt | 24 ++++++++++++++++++++-- .../SelfTest/Baselines/console.sw.approved.txt | 24 ++++++++++++++++++++-- projects/SelfTest/Baselines/junit.sw.approved.txt | 15 +++++++++++++- projects/SelfTest/Baselines/xml.sw.approved.txt | 17 +++++++++++++-- projects/SelfTest/UsageTests/Exception.tests.cpp | 9 ++++++++ 6 files changed, 85 insertions(+), 8 deletions(-) diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index f8b5b888..7988402a 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -697,6 +697,7 @@ VariadicMacros.tests.cpp:<line number>: passed: with 1 message: 'no assertions' Tricky.tests.cpp:<line number>: passed: 0x<hex digits> == bit30and31 for: 3221225472 (0x<hex digits>) == 3221225472 Message.tests.cpp:<line number>: failed - but was ok: 1 == 2 Misc.tests.cpp:<line number>: passed: with 1 message: 'oops!' +Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'For some reason someone is throwing a string literal!' PartTracker.tests.cpp:<line number>: passed: testCase.isOpen() for: true PartTracker.tests.cpp:<line number>: passed: s1.isOpen() for: true PartTracker.tests.cpp:<line number>: passed: s1.isSuccessfullyCompleted() for: true @@ -1009,6 +1010,7 @@ ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( v ) = ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" for: "{ operator<<( has_operator ) }" == "{ operator<<( has_operator ) }" +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"" @@ -1075,5 +1077,5 @@ Misc.tests.cpp:<line number>: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:<line number>: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:<line number>: passed: Misc.tests.cpp:<line number>: passed: -Failed 61 test cases, failed 120 assertions. +Failed 63 test cases, failed 122 assertions. diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index d06cdfa3..5091ff1d 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -738,6 +738,16 @@ with expansion: } " +------------------------------------------------------------------------------- +Thrown string literals are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + For some reason someone is throwing a string literal! + ------------------------------------------------------------------------------- Unexpected exceptions can be translated ------------------------------------------------------------------------------- @@ -1063,7 +1073,17 @@ Tricky.tests.cpp:<line number>: FAILED: with expansion: "first" == "second" +------------------------------------------------------------------------------- +thrown std::strings are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + Why would you throw a std::string? + =============================================================================== -test cases: 200 | 149 passed | 47 failed | 4 failed as expected -assertions: 1005 | 879 passed | 105 failed | 21 failed as expected +test cases: 202 | 149 passed | 49 failed | 4 failed as expected +assertions: 1007 | 879 passed | 107 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 0bac931d..8ffefb8c 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -5486,6 +5486,16 @@ PASSED: with message: oops! +------------------------------------------------------------------------------- +Thrown string literals are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + For some reason someone is throwing a string literal! + ------------------------------------------------------------------------------- Tracker ------------------------------------------------------------------------------- @@ -7992,6 +8002,16 @@ with expansion: == "{ operator<<( has_operator ) }" +------------------------------------------------------------------------------- +thrown std::strings are translated +------------------------------------------------------------------------------- +Exception.tests.cpp:<line number> +............................................................................... + +Exception.tests.cpp:<line number>: FAILED: +due to unexpected exception with message: + Why would you throw a std::string? + ------------------------------------------------------------------------------- toString on const wchar_t const pointer returns the string contents ------------------------------------------------------------------------------- @@ -8511,6 +8531,6 @@ Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 200 | 135 passed | 61 failed | 4 failed as expected -assertions: 1016 | 875 passed | 120 failed | 21 failed as expected +test cases: 202 | 135 passed | 63 failed | 4 failed as expected +assertions: 1018 | 875 passed | 122 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 1931ee0e..884ec027 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,8 @@ <?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <testsuitesloose text artifact > - <testsuite name="<exe-name>" errors="15" failures="106" tests="1017" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="106" tests="1019" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1005: Comparing pointer to int and long (NULL can be either on various systems)" time="{duration}"/> <testcase classname="<exe-name>.global" name="#1027" time="{duration}"/> @@ -585,6 +586,12 @@ Misc.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Test enum bit values" time="{duration}"/> <testcase classname="<exe-name>.global" name="The NO_FAIL macro reports a failure but does not fail the test" time="{duration}"/> <testcase classname="<exe-name>.global" name="This test 'should' fail but doesn't" time="{duration}"/> + <testcase classname="<exe-name>.global" name="Thrown string literals are translated" time="{duration}"> + <error type="TEST_CASE"> +For some reason someone is throwing a string literal! +Exception.tests.cpp:<line number> + </error> + </testcase> <testcase classname="<exe-name>.global" name="Tracker" time="{duration}"/> <testcase classname="<exe-name>.global" name="Tracker/successfully close one section" time="{duration}"/> <testcase classname="<exe-name>.global" name="Tracker/fail one section" time="{duration}"/> @@ -828,6 +835,12 @@ Tricky.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="stringify( vectors<has_maker> )" time="{duration}"/> <testcase classname="<exe-name>.global" name="stringify( vectors<has_maker_and_operator> )" time="{duration}"/> <testcase classname="<exe-name>.global" name="stringify( vectors<has_operator> )" time="{duration}"/> + <testcase classname="<exe-name>.global" name="thrown std::strings are translated" time="{duration}"> + <error type="TEST_CASE"> +Why would you throw a std::string? +Exception.tests.cpp:<line number> + </error> + </testcase> <testcase classname="<exe-name>.global" name="toString on const wchar_t const pointer returns the string contents" time="{duration}"/> <testcase classname="<exe-name>.global" name="toString on const wchar_t pointer returns the string contents" time="{duration}"/> <testcase classname="<exe-name>.global" name="toString on wchar_t const pointer returns the string contents" time="{duration}"/> diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 53c3937f..5c3ff86e 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1,4 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> +<?xml version="1.0" encoding="UTF-8"?> <Catch name="<exe-name>"> <Group name="<exe-name>"> <TestCase name="# A test name that starts with a #" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > @@ -6250,6 +6251,12 @@ Message from section two <TestCase name="This test 'should' fail but doesn't" tags="[!shouldfail][.][failing]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <OverallResult success="false"/> </TestCase> + <TestCase name="Thrown string literals are translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + For some reason someone is throwing a string literal! + </Exception> + <OverallResult success="false"/> + </TestCase> <TestCase name="Tracker" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Expression success="true" type="REQUIRE" filename="projects/<exe-name>/IntrospectiveTests/PartTracker.tests.cpp" > <Original> @@ -8857,6 +8864,12 @@ loose text artifact </Expression> <OverallResult success="true"/> </TestCase> + <TestCase name="thrown std::strings are translated" tags="[!throws][.][failing]" filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + <Exception filename="projects/<exe-name>/UsageTests/Exception.tests.cpp" > + Why would you throw a std::string? + </Exception> + <OverallResult success="false"/> + </TestCase> <TestCase name="toString on const wchar_t const pointer returns the string contents" tags="[toString]" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Expression success="true" type="CHECK" filename="projects/<exe-name>/UsageTests/Misc.tests.cpp" > <Original> @@ -9369,7 +9382,7 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="875" failures="121" expectedFailures="21"/> + <OverallResults successes="875" failures="123" expectedFailures="21"/> </Group> - <OverallResults successes="875" failures="120" expectedFailures="21"/> + <OverallResults successes="875" failures="122" expectedFailures="21"/> </Catch> diff --git a/projects/SelfTest/UsageTests/Exception.tests.cpp b/projects/SelfTest/UsageTests/Exception.tests.cpp index d67ef34c..3cc44d98 100644 --- a/projects/SelfTest/UsageTests/Exception.tests.cpp +++ b/projects/SelfTest/UsageTests/Exception.tests.cpp @@ -154,6 +154,15 @@ TEST_CASE( "Unexpected exceptions can be translated", "[.][failing][!throws]" ) throw double( 3.14 ); } +TEST_CASE("Thrown string literals are translated", "[.][failing][!throws]") { + throw "For some reason someone is throwing a string literal!"; +} + +TEST_CASE("thrown std::strings are translated", "[.][failing][!throws]") { + throw std::string{ "Why would you throw a std::string?" }; +} + + #ifndef CATCH_CONFIG_DISABLE_MATCHERS TEST_CASE( "Exception messages can be tested for", "[!throws]" ) {