Fix for #270 (REQUIRE continues if test throws an exception).

Added test case that reproduced the bug then applied the fix.
This commit is contained in:
Phil Nash
2014-04-12 19:07:24 +01:00
parent e9d35377fa
commit a176b93738
9 changed files with 60 additions and 12 deletions

View File

@@ -331,6 +331,17 @@ ExceptionTests.cpp:<line number>: FAILED:
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
When unchecked exceptions are thrown during a require the test should fail
-------------------------------------------------------------------------------
ExceptionTests.cpp:<line number>
...............................................................................
ExceptionTests.cpp:<line number>: FAILED:
REQUIRE( thisThrows() == 0 )
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
Unexpected custom exceptions can be translated
-------------------------------------------------------------------------------
@@ -750,5 +761,5 @@ with expansion:
"first" == "second"
===============================================================================
122 test cases - 36 failed (658 assertions - 91 failed)
123 test cases - 37 failed (659 assertions - 92 failed)

View File

@@ -1110,6 +1110,17 @@ ExceptionTests.cpp:<line number>: FAILED:
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
When unchecked exceptions are thrown during a require the test should fail
-------------------------------------------------------------------------------
ExceptionTests.cpp:<line number>
...............................................................................
ExceptionTests.cpp:<line number>: FAILED:
REQUIRE( thisThrows() == 0 )
due to unexpected exception with message:
expected exception
-------------------------------------------------------------------------------
When unchecked exceptions are thrown, but caught, they do not affect the test
-------------------------------------------------------------------------------
@@ -6958,5 +6969,5 @@ with expansion:
true
===============================================================================
122 test cases - 51 failed (677 assertions - 110 failed)
123 test cases - 52 failed (678 assertions - 111 failed)

View File

@@ -1,5 +1,5 @@
<testsuites>
<testsuite name="~_" errors="10" failures="100" tests="677" hostname="tbd" time="{duration}" timestamp="tbd">
<testsuite name="~_" errors="11" failures="100" tests="678" hostname="tbd" time="{duration}" timestamp="tbd">
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
<testcase classname="global" name="Approximate comparisons with different epsilons" time="{duration}"/>
<testcase classname="global" name="Approximate comparisons with floats" time="{duration}"/>
@@ -207,6 +207,12 @@ ExceptionTests.cpp:<line number>
<testcase classname="global" name="When unchecked exceptions are thrown from functions they are always failures" time="{duration}">
<error message="thisThrows() == 0" type="CHECK">
expected exception
ExceptionTests.cpp:<line number>
</error>
</testcase>
<testcase classname="global" name="When unchecked exceptions are thrown during a require the test should fail" time="{duration}">
<error message="thisThrows() == 0" type="REQUIRE">
expected exception
ExceptionTests.cpp:<line number>
</error>
</testcase>

View File

@@ -1426,6 +1426,20 @@
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="When unchecked exceptions are thrown during a require the test should fail">
<Expression success="false" filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
<Original>
thisThrows() == 0
</Original>
<Expanded>
thisThrows() == 0
</Expanded>
<Exception filename="/Users/philnash/Dev/OSS/Catch/projects/SelfTest/ExceptionTests.cpp" >
expected exception
</Exception>
</Expression>
<OverallResult success="false"/>
</TestCase>
<TestCase name="When unchecked exceptions are thrown, but caught, they do not affect the test">
<OverallResult success="true"/>
</TestCase>
@@ -7214,7 +7228,7 @@ there&quot;
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="567" failures="110"/>
<OverallResults successes="567" failures="111"/>
</Group>
<OverallResults successes="567" failures="110"/>
<OverallResults successes="567" failures="111"/>
</Catch>