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
REQUIRE_THROWS_AS is now reported with expected type as well
- Commit
9952dda524e5578d808e2c267fff0799f228cbd2- Author
- Martin Hořeňovský ·
- Parents
e543cc06462a
Changes
include/internal/catch_capture.hpp | 2 +- projects/SelfTest/Baselines/console.std.approved.txt | 6 +++--- projects/SelfTest/Baselines/console.sw.approved.txt | 8 ++++---- projects/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<void>(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:<line number> ............................................................................... ExceptionTests.cpp:<line number>: 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:<line number> ............................................................................... ExceptionTests.cpp:<line number>: FAILED: - CHECK_THROWS_AS( thisThrows() ) + CHECK_THROWS_AS( thisThrows(), std::string ) due to unexpected exception with message: expected exception ExceptionTests.cpp:<line number>: FAILED: - CHECK_THROWS_AS( thisDoesntThrow() ) + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) because no exception was thrown where one was expected: ExceptionTests.cpp:<line number>: 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:<line number> ............................................................................... ExceptionTests.cpp:<line number>: 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:<line number> ............................................................................... ExceptionTests.cpp:<line number>: FAILED: - CHECK_THROWS_AS( thisThrows() ) + CHECK_THROWS_AS( thisThrows(), std::string ) due to unexpected exception with message: expected exception ExceptionTests.cpp:<line number>: FAILED: - CHECK_THROWS_AS( thisDoesntThrow() ) + CHECK_THROWS_AS( thisDoesntThrow(), std::domain_error ) because no exception was thrown where one was expected: ExceptionTests.cpp:<line number>: FAILED: @@ -7878,7 +7878,7 @@ ExceptionTests.cpp:<line number> ExceptionTests.cpp:<line number>: PASSED: - REQUIRE_THROWS_AS( thisThrows() ) + REQUIRE_THROWS_AS( thisThrows(), std::domain_error ) ExceptionTests.cpp:<line number>: 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:<line number> </error> </testcase> <testcase classname="global" name="Custom exceptions can be translated when testing for throwing as something else" time="{duration}"> - <error message="throwCustom()" type="REQUIRE_THROWS_AS"> + <error message="throwCustom(), std::exception" type="REQUIRE_THROWS_AS"> custom exception - not std ExceptionTests.cpp:<line number> </error> @@ -171,11 +171,11 @@ MiscTests.cpp:<line number> <testcase classname="Exception messages can be tested for" name="different case" time="{duration}"/> <testcase classname="Exception messages can be tested for" name="wildcarded" time="{duration}"/> <testcase classname="global" name="Expected exceptions that don't throw or unexpected exceptions fail the test" time="{duration}"> - <error message="thisThrows()" type="CHECK_THROWS_AS"> + <error message="thisThrows(), std::string" type="CHECK_THROWS_AS"> expected exception ExceptionTests.cpp:<line number> </error> - <failure message="thisDoesntThrow()" type="CHECK_THROWS_AS"> + <failure message="thisDoesntThrow(), std::domain_error" type="CHECK_THROWS_AS"> ExceptionTests.cpp:<line number> </failure> <error message="thisThrows()" type="CHECK_NOTHROW"> 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 @@ <TestCase name="Custom exceptions can be translated when testing for throwing as something else" tags="[!throws][.][failing][hide]"> <Expression success="false" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/ExceptionTests.cpp" > <Original> - throwCustom() + throwCustom(), std::exception </Original> <Expanded> - throwCustom() + throwCustom(), std::exception </Expanded> <Exception filename="projects/<exe-name>/ExceptionTests.cpp" > custom exception - not std @@ -1221,10 +1221,10 @@ <TestCase name="Expected exceptions that don't throw or unexpected exceptions fail the test" tags="[!throws][.][failing][hide]"> <Expression success="false" type="CHECK_THROWS_AS" filename="projects/<exe-name>/ExceptionTests.cpp" > <Original> - thisThrows() + thisThrows(), std::string </Original> <Expanded> - thisThrows() + thisThrows(), std::string </Expanded> <Exception filename="projects/<exe-name>/ExceptionTests.cpp" > expected exception @@ -1232,10 +1232,10 @@ </Expression> <Expression success="false" type="CHECK_THROWS_AS" filename="projects/<exe-name>/ExceptionTests.cpp" > <Original> - thisDoesntThrow() + thisDoesntThrow(), std::domain_error </Original> <Expanded> - thisDoesntThrow() + thisDoesntThrow(), std::domain_error </Expanded> </Expression> <Expression success="false" type="CHECK_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" > @@ -8400,10 +8400,10 @@ there" <TestCase name="When checked exceptions are thrown they can be expected or unexpected" tags="[!throws]"> <Expression success="true" type="REQUIRE_THROWS_AS" filename="projects/<exe-name>/ExceptionTests.cpp" > <Original> - thisThrows() + thisThrows(), std::domain_error </Original> <Expanded> - thisThrows() + thisThrows(), std::domain_error </Expanded> </Expression> <Expression success="true" type="REQUIRE_NOTHROW" filename="projects/<exe-name>/ExceptionTests.cpp" >