From e5fe3e877af40f3bd027f333831dbf554286a496 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sat, 12 May 2018 20:37:13 +0200 Subject: [PATCH] Ensure platform-independent output from SpecialException::what --- 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:: failed: expected exception, got none; expressi Matchers.tests.cpp:: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1} Matchers.tests.cpp:: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} Matchers.tests.cpp:: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1} -Matchers.tests.cpp:: failed: throws(3), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1 -Matchers.tests.cpp:: failed: throws(4), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1 -Matchers.tests.cpp:: passed: throws(1), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1 -Matchers.tests.cpp:: passed: throws(2), SpecialException, ExceptionMatcher{2} for: std::exception special exception has value of 2 +Matchers.tests.cpp:: failed: throws(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:: failed: throws(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:: passed: throws(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1 +Matchers.tests.cpp:: passed: throws(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2 Exception.tests.cpp:: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception" Exception.tests.cpp:: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive) Exception.tests.cpp:: 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: Matchers.tests.cpp:: 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:: 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: Matchers.tests.cpp:: 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:: 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:: 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:: 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: - + Matchers.tests.cpp: - + Matchers.tests.cpp: 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} - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 @@ -1991,7 +1991,7 @@ throws(4), SpecialException, ExceptionMatcher{1} - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 @@ -2004,7 +2004,7 @@ throws(1), SpecialException, ExceptionMatcher{1} - std::exception special exception has value of 1 + SpecialException::what special exception has value of 1 @@ -2012,7 +2012,7 @@ throws(2), SpecialException, ExceptionMatcher{2} - std::exception special exception has value of 2 + SpecialException::what special exception has value of 2 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; };