From 9952dda524e5578d808e2c267fff0799f228cbd2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Thu, 9 Feb 2017 12:41:16 +0100 Subject: [PATCH] REQUIRE_THROWS_AS is now reported with expected type as well Also updated tests to reflect this change. --- include/internal/catch_capture.hpp | 2 +- .../SelfTest/Baselines/console.std.approved.txt | 6 +++--- .../SelfTest/Baselines/console.sw.approved.txt | 8 ++++---- .../SelfTest/Baselines/junit.sw.approved.txt | 6 +++--- projects/SelfTest/Baselines/xml.sw.approved.txt | 16 ++++++++-------- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/include/internal/catch_capture.hpp b/include/internal/catch_capture.hpp index 04be7016..ae10f58a 100644 --- a/include/internal/catch_capture.hpp +++ b/include/internal/catch_capture.hpp @@ -87,7 +87,7 @@ /////////////////////////////////////////////////////////////////////////////// #define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, resultDisposition, macroName ) \ do { \ - Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr, resultDisposition ); \ + Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #expr ", " #exceptionType, resultDisposition ); \ if( __catchResult.allowThrows() ) \ try { \ static_cast(expr); \ diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index 2b9f5696..13519449 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -131,7 +131,7 @@ ExceptionTests.cpp: ............................................................................... ExceptionTests.cpp:: FAILED: - REQUIRE_THROWS_AS( throwCustom() ) + REQUIRE_THROWS_AS( throwCustom(), std::exception ) due to unexpected exception with message: custom exception - not std @@ -245,12 +245,12 @@ ExceptionTests.cpp: ............................................................................... ExceptionTests.cpp:: FAILED: - CHECK_THROWS_AS( thisThrows() ) + CHECK_THROWS_AS( thisThrows(), std::string ) due to unexpected exception with message: expected exception ExceptionTests.cpp:: FAILED: - CHECK_THROWS_AS( thisDoesntThrow() ) + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) because no exception was thrown where one was expected: ExceptionTests.cpp:: FAILED: diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index f04d8566..c9b7584f 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -852,7 +852,7 @@ ExceptionTests.cpp: ............................................................................... ExceptionTests.cpp:: FAILED: - REQUIRE_THROWS_AS( throwCustom() ) + REQUIRE_THROWS_AS( throwCustom(), std::exception ) due to unexpected exception with message: custom exception - not std @@ -1096,12 +1096,12 @@ ExceptionTests.cpp: ............................................................................... ExceptionTests.cpp:: FAILED: - CHECK_THROWS_AS( thisThrows() ) + CHECK_THROWS_AS( thisThrows(), std::string ) due to unexpected exception with message: expected exception ExceptionTests.cpp:: FAILED: - CHECK_THROWS_AS( thisDoesntThrow() ) + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) because no exception was thrown where one was expected: ExceptionTests.cpp:: FAILED: @@ -7878,7 +7878,7 @@ ExceptionTests.cpp: ExceptionTests.cpp:: PASSED: - REQUIRE_THROWS_AS( thisThrows() ) + REQUIRE_THROWS_AS( thisThrows(), std::domain_error ) ExceptionTests.cpp:: PASSED: diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 4fe585b5..22506660 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -101,7 +101,7 @@ ExceptionTests.cpp: - + custom exception - not std ExceptionTests.cpp: @@ -171,11 +171,11 @@ MiscTests.cpp: - + expected exception ExceptionTests.cpp: - + ExceptionTests.cpp: diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 974c212d..2cead6b9 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -920,10 +920,10 @@ - throwCustom() + throwCustom(), std::exception - throwCustom() + throwCustom(), std::exception custom exception - not std @@ -1221,10 +1221,10 @@ - thisThrows() + thisThrows(), std::string - thisThrows() + thisThrows(), std::string expected exception @@ -1232,10 +1232,10 @@ - thisDoesntThrow() + thisDoesntThrow(), std::domain_error - thisDoesntThrow() + thisDoesntThrow(), std::domain_error @@ -8400,10 +8400,10 @@ there" - thisThrows() + thisThrows(), std::domain_error - thisThrows() + thisThrows(), std::domain_error