mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
Ensure platform-independent output from SpecialException::what
This commit is contained in:
parent
6c5c4c43a0
commit
e5fe3e877a
@ -222,10 +222,10 @@ Matchers.tests.cpp:<line number>: failed: expected exception, got none; expressi
|
|||||||
Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1}
|
Matchers.tests.cpp:<line number>: failed: expected exception, got none; expression was: doesNotThrow(), SpecialException, ExceptionMatcher{1}
|
||||||
Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
|
Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
|
||||||
Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
|
Matchers.tests.cpp:<line number>: failed: unexpected exception with message: 'Unknown exception'; expression was: throwsAsInt(1), SpecialException, ExceptionMatcher{1}
|
||||||
Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1
|
Matchers.tests.cpp:<line number>: failed: throws(3), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1
|
||||||
Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1
|
Matchers.tests.cpp:<line number>: failed: throws(4), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1
|
||||||
Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: std::exception special exception has value of 1
|
Matchers.tests.cpp:<line number>: passed: throws(1), SpecialException, ExceptionMatcher{1} for: SpecialException::what special exception has value of 1
|
||||||
Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: std::exception special exception has value of 2
|
Matchers.tests.cpp:<line number>: passed: throws(2), SpecialException, ExceptionMatcher{2} for: SpecialException::what special exception has value of 2
|
||||||
Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception"
|
Exception.tests.cpp:<line number>: passed: thisThrows(), "expected exception" for: "expected exception" equals: "expected exception"
|
||||||
Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive)
|
Exception.tests.cpp:<line number>: passed: thisThrows(), Equals( "expecteD Exception", Catch::CaseSensitive::No ) for: "expected exception" equals: "expected exception" (case insensitive)
|
||||||
Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected"
|
Exception.tests.cpp:<line number>: passed: thisThrows(), StartsWith( "expected" ) for: "expected exception" starts with: "expected"
|
||||||
|
@ -335,12 +335,12 @@ Matchers.tests.cpp:<line number>
|
|||||||
Matchers.tests.cpp:<line number>: FAILED:
|
Matchers.tests.cpp:<line number>: FAILED:
|
||||||
CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
|
CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
|
||||||
with expansion:
|
with expansion:
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
|
|
||||||
Matchers.tests.cpp:<line number>: FAILED:
|
Matchers.tests.cpp:<line number>: FAILED:
|
||||||
REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
|
REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
|
||||||
with expansion:
|
with expansion:
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Expected exceptions that don't throw or unexpected exceptions fail the test
|
Expected exceptions that don't throw or unexpected exceptions fail the test
|
||||||
|
@ -1750,12 +1750,12 @@ Matchers.tests.cpp:<line number>
|
|||||||
Matchers.tests.cpp:<line number>: FAILED:
|
Matchers.tests.cpp:<line number>: FAILED:
|
||||||
CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
|
CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} )
|
||||||
with expansion:
|
with expansion:
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
|
|
||||||
Matchers.tests.cpp:<line number>: FAILED:
|
Matchers.tests.cpp:<line number>: FAILED:
|
||||||
REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
|
REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} )
|
||||||
with expansion:
|
with expansion:
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Exception matchers that succeed
|
Exception matchers that succeed
|
||||||
@ -1767,13 +1767,13 @@ Matchers.tests.cpp:<line number>:
|
|||||||
PASSED:
|
PASSED:
|
||||||
CHECK_THROWS_MATCHES( throws(1), SpecialException, ExceptionMatcher{1} )
|
CHECK_THROWS_MATCHES( throws(1), SpecialException, ExceptionMatcher{1} )
|
||||||
with expansion:
|
with expansion:
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
|
|
||||||
Matchers.tests.cpp:<line number>:
|
Matchers.tests.cpp:<line number>:
|
||||||
PASSED:
|
PASSED:
|
||||||
REQUIRE_THROWS_MATCHES( throws(2), SpecialException, ExceptionMatcher{2} )
|
REQUIRE_THROWS_MATCHES( throws(2), SpecialException, ExceptionMatcher{2} )
|
||||||
with expansion:
|
with expansion:
|
||||||
std::exception special exception has value of 2
|
SpecialException::what special exception has value of 2
|
||||||
|
|
||||||
-------------------------------------------------------------------------------
|
-------------------------------------------------------------------------------
|
||||||
Exception messages can be tested for
|
Exception messages can be tested for
|
||||||
|
@ -238,10 +238,10 @@ Matchers.tests.cpp:<line number>
|
|||||||
</error>
|
</error>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}">
|
<testcase classname="<exe-name>.global" name="Exception matchers that fail/Contents are wrong" time="{duration}">
|
||||||
<failure message="std::exception special exception has value of 1" type="CHECK_THROWS_MATCHES">
|
<failure message="SpecialException::what special exception has value of 1" type="CHECK_THROWS_MATCHES">
|
||||||
Matchers.tests.cpp:<line number>
|
Matchers.tests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
<failure message="std::exception special exception has value of 1" type="REQUIRE_THROWS_MATCHES">
|
<failure message="SpecialException::what special exception has value of 1" type="REQUIRE_THROWS_MATCHES">
|
||||||
Matchers.tests.cpp:<line number>
|
Matchers.tests.cpp:<line number>
|
||||||
</failure>
|
</failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
|
@ -1983,7 +1983,7 @@
|
|||||||
throws(3), SpecialException, ExceptionMatcher{1}
|
throws(3), SpecialException, ExceptionMatcher{1}
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
<Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
@ -1991,7 +1991,7 @@
|
|||||||
throws(4), SpecialException, ExceptionMatcher{1}
|
throws(4), SpecialException, ExceptionMatcher{1}
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResults successes="0" failures="2" expectedFailures="0"/>
|
<OverallResults successes="0" failures="2" expectedFailures="0"/>
|
||||||
@ -2004,7 +2004,7 @@
|
|||||||
throws(1), SpecialException, ExceptionMatcher{1}
|
throws(1), SpecialException, ExceptionMatcher{1}
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
std::exception special exception has value of 1
|
SpecialException::what special exception has value of 1
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
<Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" >
|
||||||
@ -2012,7 +2012,7 @@
|
|||||||
throws(2), SpecialException, ExceptionMatcher{2}
|
throws(2), SpecialException, ExceptionMatcher{2}
|
||||||
</Original>
|
</Original>
|
||||||
<Expanded>
|
<Expanded>
|
||||||
std::exception special exception has value of 2
|
SpecialException::what special exception has value of 2
|
||||||
</Expanded>
|
</Expanded>
|
||||||
</Expression>
|
</Expression>
|
||||||
<OverallResult success="true"/>
|
<OverallResult success="true"/>
|
||||||
|
@ -45,6 +45,10 @@ namespace { namespace MatchersTests {
|
|||||||
struct SpecialException : std::exception {
|
struct SpecialException : std::exception {
|
||||||
SpecialException(int i_) : i(i_) {}
|
SpecialException(int i_) : i(i_) {}
|
||||||
|
|
||||||
|
char const* what() const noexcept override {
|
||||||
|
return "SpecialException::what";
|
||||||
|
}
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user