diff --git a/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt index fe760fd7..e6bcf41e 100644 --- a/projects/SelfTest/Baselines/console.std.approved.txt +++ b/projects/SelfTest/Baselines/console.std.approved.txt @@ -3,6 +3,18 @@ is a host application. Run with -? for options +------------------------------------------------------------------------------- +#748 - captures with unexpected exceptions + outside assertions +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with messages: + answer := 42 + expected exception + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions inside REQUIRE_NOTHROW @@ -115,6 +127,17 @@ TrickyTests.cpp:: FAILED: with expansion: {?} == {?} +------------------------------------------------------------------------------- +An unchecked exception reports the line of the last assertion +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: + {Unknown expression after the reported line} +due to unexpected exception with message: + unexpected exception + ------------------------------------------------------------------------------- Contains string matcher ------------------------------------------------------------------------------- @@ -148,6 +171,16 @@ ExceptionTests.cpp:: FAILED: due to unexpected exception with message: custom exception - not std +------------------------------------------------------------------------------- +Custom std-exceptions can be custom translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + custom std exception + ------------------------------------------------------------------------------- EndsWith string matcher ------------------------------------------------------------------------------- @@ -413,6 +446,16 @@ MiscTests.cpp:: warning: This one ran +------------------------------------------------------------------------------- +Non-std exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + custom exception + ------------------------------------------------------------------------------- Ordering comparison checks that should fail ------------------------------------------------------------------------------- @@ -599,6 +642,16 @@ with expansion: } " +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + 3.14 + ------------------------------------------------------------------------------- Vector matchers that fail Contains (element) @@ -660,6 +713,16 @@ MatchersTests.cpp:: FAILED: with expansion: { 1, 2, 3 } Equals: { } +------------------------------------------------------------------------------- +When unchecked exceptions are thrown directly they are always failures +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + ------------------------------------------------------------------------------- When unchecked exceptions are thrown during a CHECK the test should continue ------------------------------------------------------------------------------- @@ -694,6 +757,17 @@ ExceptionTests.cpp:: FAILED: due to unexpected exception with message: expected exception +------------------------------------------------------------------------------- +When unchecked exceptions are thrown from sections they are always failures + section name +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + ------------------------------------------------------------------------------- Where the LHS is not a simple value ------------------------------------------------------------------------------- @@ -866,6 +940,6 @@ with expansion: "first" == "second" =============================================================================== -test cases: 167 | 125 passed | 38 failed | 4 failed as expected -assertions: 960 | 859 passed | 81 failed | 20 failed as expected +test cases: 167 | 119 passed | 44 failed | 4 failed as expected +assertions: 967 | 859 passed | 87 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt index 954e80e6..ac178f80 100644 --- a/projects/SelfTest/Baselines/console.sw.approved.txt +++ b/projects/SelfTest/Baselines/console.sw.approved.txt @@ -14,6 +14,18 @@ PASSED: with message: yay +------------------------------------------------------------------------------- +#748 - captures with unexpected exceptions + outside assertions +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with messages: + answer := 42 + expected exception + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions inside REQUIRE_NOTHROW @@ -444,6 +456,11 @@ ExceptionTests.cpp:: PASSED: CHECK( 1 == 1 ) +ExceptionTests.cpp:: FAILED: + {Unknown expression after the reported line} +due to unexpected exception with message: + unexpected exception + ------------------------------------------------------------------------------- Anonymous test case 1 ------------------------------------------------------------------------------- @@ -998,6 +1015,16 @@ ExceptionTests.cpp:: FAILED: due to unexpected exception with message: custom exception - not std +------------------------------------------------------------------------------- +Custom std-exceptions can be custom translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + custom std exception + ------------------------------------------------------------------------------- Demonstrate that a non-const == is not used ------------------------------------------------------------------------------- @@ -4508,6 +4535,16 @@ MiscTests.cpp:: warning: This one ran +------------------------------------------------------------------------------- +Non-std exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + custom exception + ------------------------------------------------------------------------------- NotImplemented exception ------------------------------------------------------------------------------- @@ -7945,6 +7982,16 @@ PASSED: with expansion: true +------------------------------------------------------------------------------- +Unexpected exceptions can be translated +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + 3.14 + ------------------------------------------------------------------------------- Use a custom approx ------------------------------------------------------------------------------- @@ -8165,6 +8212,16 @@ ExceptionTests.cpp:: PASSED: REQUIRE_THROWS( thisThrows() ) +------------------------------------------------------------------------------- +When unchecked exceptions are thrown directly they are always failures +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + ------------------------------------------------------------------------------- When unchecked exceptions are thrown during a CHECK the test should continue ------------------------------------------------------------------------------- @@ -8199,6 +8256,17 @@ ExceptionTests.cpp:: FAILED: due to unexpected exception with message: expected exception +------------------------------------------------------------------------------- +When unchecked exceptions are thrown from sections they are always failures + section name +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with message: + unexpected exception + ------------------------------------------------------------------------------- Where the LHS is not a simple value ------------------------------------------------------------------------------- @@ -9398,6 +9466,6 @@ MiscTests.cpp:: PASSED: =============================================================================== -test cases: 167 | 124 passed | 39 failed | 4 failed as expected -assertions: 962 | 859 passed | 83 failed | 20 failed as expected +test cases: 167 | 118 passed | 45 failed | 4 failed as expected +assertions: 969 | 859 passed | 89 failed | 21 failed as expected diff --git a/projects/SelfTest/Baselines/console.swa4.approved.txt b/projects/SelfTest/Baselines/console.swa4.approved.txt index e9a0cbb7..dcabf4e0 100644 --- a/projects/SelfTest/Baselines/console.swa4.approved.txt +++ b/projects/SelfTest/Baselines/console.swa4.approved.txt @@ -14,6 +14,18 @@ PASSED: with message: yay +------------------------------------------------------------------------------- +#748 - captures with unexpected exceptions + outside assertions +------------------------------------------------------------------------------- +ExceptionTests.cpp: +............................................................................... + +ExceptionTests.cpp:: FAILED: +due to unexpected exception with messages: + answer := 42 + expected exception + ------------------------------------------------------------------------------- #748 - captures with unexpected exceptions inside REQUIRE_NOTHROW @@ -133,5 +145,5 @@ ConditionTests.cpp:: FAILED: =============================================================================== test cases: 6 | 3 passed | 1 failed | 2 failed as expected -assertions: 17 | 11 passed | 4 failed | 2 failed as expected +assertions: 18 | 11 passed | 4 failed | 3 failed as expected diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt index 45ba1ad8..b1b02add 100644 --- a/projects/SelfTest/Baselines/junit.sw.approved.txt +++ b/projects/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,14 @@ - + + + +expected exception +answer := 42 +ExceptionTests.cpp: + + expected exception @@ -79,7 +86,12 @@ TrickyTests.cpp: - + + +unexpected exception +ExceptionTests.cpp: + + @@ -115,6 +127,12 @@ ExceptionTests.cpp: custom exception - not std +ExceptionTests.cpp: + + + + +custom std exception ExceptionTests.cpp: @@ -282,6 +300,12 @@ ExceptionTests.cpp: + + +custom exception +ExceptionTests.cpp: + + @@ -497,6 +521,12 @@ MiscTests.cpp: + + +3.14 +ExceptionTests.cpp: + + @@ -533,6 +563,12 @@ MatchersTests.cpp: + + +unexpected exception +ExceptionTests.cpp: + + expected exception @@ -548,6 +584,12 @@ ExceptionTests.cpp: expected exception +ExceptionTests.cpp: + + + + +unexpected exception ExceptionTests.cpp: diff --git a/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt index 526f68aa..fed55cd0 100644 --- a/projects/SelfTest/Baselines/xml.sw.approved.txt +++ b/projects/SelfTest/Baselines/xml.sw.approved.txt @@ -6,7 +6,13 @@
- + + answer := 42 + + + expected exception + +
@@ -506,7 +512,18 @@ 1 == 1 - + + + {Unknown expression after the reported line} + + + {Unknown expression after the reported line} + + + unexpected exception + + + @@ -1110,7 +1127,10 @@ - + + custom std exception + + @@ -4635,7 +4655,10 @@ re>" - + + custom exception + + @@ -8586,7 +8609,10 @@ there" - + + 3.14 + + @@ -8849,7 +8875,10 @@ there" - + + unexpected exception + + @@ -8895,9 +8924,12 @@ there"
- + + unexpected exception + +
- +
@@ -10082,7 +10114,7 @@ spanner
- + - +