mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
Added _THROWS_WITH macros
- asserts on exception message
This commit is contained in:
@@ -397,6 +397,17 @@ ExceptionTests.cpp:<line number>: FAILED:
|
||||
due to unexpected exception with message:
|
||||
3.14
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Exception messages can be tested for
|
||||
-------------------------------------------------------------------------------
|
||||
ExceptionTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ExceptionTests.cpp:<line number>: FAILED:
|
||||
REQUIRE_THROWS_WITH( thisThrows(), "should fail" )
|
||||
with expansion:
|
||||
expected exception
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
INFO and WARN do not abort tests
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -786,6 +797,6 @@ with expansion:
|
||||
"first" == "second"
|
||||
|
||||
===============================================================================
|
||||
test cases: 155 | 116 passed | 38 failed | 1 failed as expected
|
||||
assertions: 765 | 673 passed | 79 failed | 13 failed as expected
|
||||
test cases: 156 | 116 passed | 39 failed | 1 failed as expected
|
||||
assertions: 767 | 674 passed | 80 failed | 13 failed as expected
|
||||
|
||||
|
@@ -1277,6 +1277,21 @@ ExceptionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THROWS( thisFunctionNotImplemented( 7 ) )
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Exception messages can be tested for
|
||||
-------------------------------------------------------------------------------
|
||||
ExceptionTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
ExceptionTests.cpp:<line number>:
|
||||
PASSED:
|
||||
REQUIRE_THROWS_WITH( thisThrows(), "expected exception" )
|
||||
|
||||
ExceptionTests.cpp:<line number>: FAILED:
|
||||
REQUIRE_THROWS_WITH( thisThrows(), "should fail" )
|
||||
with expansion:
|
||||
expected exception
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
Generators over two ranges
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -7944,6 +7959,6 @@ with expansion:
|
||||
true
|
||||
|
||||
===============================================================================
|
||||
test cases: 155 | 100 passed | 54 failed | 1 failed as expected
|
||||
assertions: 785 | 673 passed | 99 failed | 13 failed as expected
|
||||
test cases: 156 | 100 passed | 55 failed | 1 failed as expected
|
||||
assertions: 787 | 674 passed | 100 failed | 13 failed as expected
|
||||
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<testsuites>
|
||||
<testsuite name="all tests" errors="12" failures="87" tests="785" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testsuite name="all tests" errors="12" failures="88" tests="787" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||
@@ -251,6 +251,11 @@ ExceptionTests.cpp:<line number>
|
||||
</error>
|
||||
</testcase>
|
||||
<testcase classname="global" name="NotImplemented exception" time="{duration}"/>
|
||||
<testcase classname="global" name="Exception messages can be tested for" time="{duration}">
|
||||
<failure message="expected exception" type="REQUIRE_THROWS_WITH">
|
||||
ExceptionTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="global" name="Generators over two ranges" time="{duration}"/>
|
||||
<testcase classname="global" name="Generator over a range of pairs" time="{duration}"/>
|
||||
<testcase classname="global" name="INFO and WARN do not abort tests" time="{duration}"/>
|
||||
|
@@ -1596,6 +1596,25 @@
|
||||
</Expression>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<TestCase name="Exception messages can be tested for">
|
||||
<Expression success="true" type="REQUIRE_THROWS_WITH" filename="projects/SelfTest/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows(), "expected exception"
|
||||
</Original>
|
||||
<Expanded>
|
||||
thisThrows(), "expected exception"
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<Expression success="false" type="REQUIRE_THROWS_WITH" filename="projects/SelfTest/ExceptionTests.cpp" >
|
||||
<Original>
|
||||
thisThrows(), "should fail"
|
||||
</Original>
|
||||
<Expanded>
|
||||
expected exception
|
||||
</Expanded>
|
||||
</Expression>
|
||||
<OverallResult success="false"/>
|
||||
</TestCase>
|
||||
<TestCase name="Generators over two ranges">
|
||||
<Expression success="true" type="CATCH_REQUIRE" filename="projects/SelfTest/GeneratorTests.cpp" >
|
||||
<Original>
|
||||
@@ -8220,7 +8239,7 @@ there"
|
||||
</Section>
|
||||
<OverallResult success="true"/>
|
||||
</TestCase>
|
||||
<OverallResults successes="673" failures="99" expectedFailures="13"/>
|
||||
<OverallResults successes="674" failures="100" expectedFailures="13"/>
|
||||
</Group>
|
||||
<OverallResults successes="673" failures="99" expectedFailures="13"/>
|
||||
<OverallResults successes="674" failures="100" expectedFailures="13"/>
|
||||
</Catch>
|
||||
|
Reference in New Issue
Block a user