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:: passed: with 1 message: 'no assertions' Tricky.tests.cpp:: passed: 0x == bit30and31 for: 3221225472 (0x) == 3221225472 Message.tests.cpp:: failed - but was ok: 1 == 2 Misc.tests.cpp:: passed: with 1 message: 'oops!' +Exception.tests.cpp:: failed: unexpected exception with message: 'For some reason someone is throwing a string literal!' PartTracker.tests.cpp:: passed: testCase.isOpen() for: true PartTracker.tests.cpp:: passed: s1.isOpen() for: true PartTracker.tests.cpp:: passed: s1.isSuccessfullyCompleted() for: true @@ -1009,6 +1010,7 @@ ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( v ) = ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify( v ) == "{ operator<<( has_operator ) }" for: "{ operator<<( has_operator ) }" == "{ operator<<( has_operator ) }" +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"" Misc.tests.cpp:: passed: result == "/"wide load/"" for: ""wide load"" == ""wide load"" @@ -1075,5 +1077,5 @@ Misc.tests.cpp:: passed: v.size() == 5 for: 5 == 5 Misc.tests.cpp:: passed: v.capacity() >= 5 for: 5 >= 5 Misc.tests.cpp:: passed: Misc.tests.cpp:: 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: +............................................................................... + +Exception.tests.cpp:: 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:: FAILED: with expansion: "first" == "second" -=============================================================================== -test cases: 200 | 149 passed | 47 failed | 4 failed as expected -assertions: 1005 | 879 passed | 105 failed | 21 failed as expected +------------------------------------------------------------------------------- +thrown std::strings are translated +------------------------------------------------------------------------------- +Exception.tests.cpp: +............................................................................... + +Exception.tests.cpp:: FAILED: +due to unexpected exception with message: + Why would you throw a std::string? + +=============================================================================== +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: +............................................................................... + +Exception.tests.cpp:: 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: +............................................................................... + +Exception.tests.cpp:: 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:: 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 @@ + - + @@ -585,6 +586,12 @@ Misc.tests.cpp: + + +For some reason someone is throwing a string literal! +Exception.tests.cpp: + + @@ -828,6 +835,12 @@ Tricky.tests.cpp: + + +Why would you throw a std::string? +Exception.tests.cpp: + + 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 @@ + @@ -6250,6 +6251,12 @@ Message from section two + + + For some reason someone is throwing a string literal! + + + @@ -8857,6 +8864,12 @@ loose text artifact + + + Why would you throw a std::string? + + + @@ -9369,7 +9382,7 @@ loose text artifact - + - + 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]" ) {