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
Ensure platform-independent output from SpecialException::what
- Commit
e5fe3e877af40f3bd027f333831dbf554286a496- Author
- Martin Hořeňovský ·
- Parents
6c5c4c43a005
Changes
projects/SelfTest/Baselines/compact.sw.approved.txt | 8 ++++---- projects/SelfTest/Baselines/console.std.approved.txt | 4 ++-- projects/SelfTest/Baselines/console.sw.approved.txt | 8 ++++---- projects/SelfTest/Baselines/junit.sw.approved.txt | 4 ++-- projects/SelfTest/Baselines/xml.sw.approved.txt | 8 ++++---- projects/SelfTest/UsageTests/Matchers.tests.cpp | 4 ++++ 6 files changed, 20 insertions(+), 16 deletions(-) diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt index 87a43f5f..7e844449 100644 --- a/projects/SelfTest/Baselines/compact.sw.approved.txt +++ b/projects/SelfTest/Baselines/compact.sw.approved.txt @@ -222,10 +222,10 @@ Matchers.tests.cpp:<line number>: failed: expected exception, got none; expressi Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} -Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1 -Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1 -Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1 -Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: std::exception special exception has value of 2 +Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2 Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected" diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 694762ab..ff31a88a 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -335,12 +335,12 @@ Matchers.tests.cpp:<line number> Matchers.tests.cpp:<line number>: FAILED: CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} ) with expansion: - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: FAILED: REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} ) with expansion: - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 ------------------------------------------------------------------------------- Expected exceptions that don't throw or unexpected exceptions fail the test diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 10f50906..a32ef10e 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -1750,12 +1750,12 @@ Matchers.tests.cpp:<line number> Matchers.tests.cpp:<line number>: FAILED: CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} ) with expansion: - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: FAILED: REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} ) with expansion: - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 ------------------------------------------------------------------------------- Exception matchers that succeed @@ -1767,13 +1767,13 @@ Matchers.tests.cpp:<line number>: PASSED: CHECK_THROWS_MATCHES( throws(1), SpecialException, ExceptionMatcher{1} ) with expansion: - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 Matchers.tests.cpp:<line number>: PASSED: REQUIRE_THROWS_MATCHES( throws(2), SpecialException, ExceptionMatcher{2} ) with expansion: - std::exception special exception has value of 2 + SpecialException::what special exception has value of 2 ------------------------------------------------------------------------------- Exception messages can be tested for diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 54783914..ffc85e6b 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -238,10 +238,10 @@ Matchers.tests.cpp:<line number> </error> </testcase> <testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}"> - <failure message="std::exception special exception has value of 1" type="CHECK_THROWS_MATCHES"> + <failure message="SpecialException::what special exception has value of 1" type="CHECK_THROWS_MATCHES"> Matchers.tests.cpp:<line number> </failure> - <failure message="std::exception special exception has value of 1" type="REQUIRE_THROWS_MATCHES"> + <failure message="SpecialException::what special exception has value of 1" type="REQUIRE_THROWS_MATCHES"> Matchers.tests.cpp:<line number> </failure> </testcase> diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 72d06ac8..af7f468e 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -1983,7 +1983,7 @@ throws(3), SpecialException, ExceptionMatcher{1} </Original> <Expanded> - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 </Expanded> </Expression> <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -1991,7 +1991,7 @@ throws(4), SpecialException, ExceptionMatcher{1} </Original> <Expanded> - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 </Expanded> </Expression> <OverallResults successes="0" failures="2" expectedFailures="0"/> @@ -2004,7 +2004,7 @@ throws(1), SpecialException, ExceptionMatcher{1} </Original> <Expanded> - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 </Expanded> </Expression> <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > @@ -2012,7 +2012,7 @@ throws(2), SpecialException, ExceptionMatcher{2} </Original> <Expanded> - std::exception special exception has value of 2 + SpecialException::what special exception has value of 2 </Expanded> </Expression> <OverallResult success="true"/> diff --git a/projects/SelfTest/UsageTests/Matchers.tests.cpp b/projects/SelfTest/UsageTests/Matchers.tests.cpp index 7bdc466b..71abb868 100644 --- a/projects/SelfTest/UsageTests/Matchers.tests.cpp +++ b/projects/SelfTest/UsageTests/Matchers.tests.cpp @@ -45,6 +45,10 @@ namespace { namespace MatchersTests { struct SpecialException : std::exception { SpecialException(int i_) : i(i_) {} + char const* what() const noexcept override { + return "SpecialException::what"; + } + int i; };