mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-25 23:06:10 +01:00
REQUIRE_THROWS_AS is now reported with expected type as well
Also updated tests to reflect this change.
This commit is contained in:
parent
e543cc0646
commit
9952dda524
@ -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); \
|
||||
|
@ -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:
|
||||
|
@ -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:
|
||||
|
@ -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">
|
||||
|
@ -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" >
|
||||
|
Loading…
Reference in New Issue
Block a user