mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Ensure platform-independent output from SpecialException::what
This commit is contained in:
		| @@ -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: 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(4), SpecialException, ExceptionMatcher{1} for: std::exception 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(2), SpecialException, ExceptionMatcher{2} for: std::exception special exception has value of 2 | ||||
| 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: SpecialException::what 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: 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(), 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" | ||||
|   | ||||
| @@ -335,12 +335,12 @@ Matchers.tests.cpp:<line number> | ||||
| Matchers.tests.cpp:<line number>: FAILED: | ||||
|   CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} ) | ||||
| with expansion: | ||||
|   std::exception special exception has value of 1 | ||||
|   SpecialException::what special exception has value of 1 | ||||
|  | ||||
| Matchers.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} ) | ||||
| 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 | ||||
|   | ||||
| @@ -1750,12 +1750,12 @@ Matchers.tests.cpp:<line number> | ||||
| Matchers.tests.cpp:<line number>: FAILED: | ||||
|   CHECK_THROWS_MATCHES( throws(3), SpecialException, ExceptionMatcher{1} ) | ||||
| with expansion: | ||||
|   std::exception special exception has value of 1 | ||||
|   SpecialException::what special exception has value of 1 | ||||
|  | ||||
| Matchers.tests.cpp:<line number>: FAILED: | ||||
|   REQUIRE_THROWS_MATCHES( throws(4), SpecialException, ExceptionMatcher{1} ) | ||||
| with expansion: | ||||
|   std::exception special exception has value of 1 | ||||
|   SpecialException::what special exception has value of 1 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Exception matchers that succeed | ||||
| @@ -1767,13 +1767,13 @@ Matchers.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   CHECK_THROWS_MATCHES( throws(1), SpecialException, ExceptionMatcher{1} ) | ||||
| with expansion: | ||||
|   std::exception special exception has value of 1 | ||||
|   SpecialException::what special exception has value of 1 | ||||
|  | ||||
| Matchers.tests.cpp:<line number>: | ||||
| PASSED: | ||||
|   REQUIRE_THROWS_MATCHES( throws(2), SpecialException, ExceptionMatcher{2} ) | ||||
| with expansion: | ||||
|   std::exception special exception has value of 2 | ||||
|   SpecialException::what special exception has value of 2 | ||||
|  | ||||
| ------------------------------------------------------------------------------- | ||||
| Exception messages can be tested for | ||||
|   | ||||
| @@ -238,10 +238,10 @@ Matchers.tests.cpp:<line number> | ||||
|       </error> | ||||
|     </testcase> | ||||
|     <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> | ||||
|       </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> | ||||
|       </failure> | ||||
|     </testcase> | ||||
|   | ||||
| @@ -1983,7 +1983,7 @@ | ||||
|             throws(3), SpecialException, ExceptionMatcher{1} | ||||
|           </Original> | ||||
|           <Expanded> | ||||
|             std::exception special exception has value of 1 | ||||
|             SpecialException::what special exception has value of 1 | ||||
|           </Expanded> | ||||
|         </Expression> | ||||
|         <Expression success="false" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > | ||||
| @@ -1991,7 +1991,7 @@ | ||||
|             throws(4), SpecialException, ExceptionMatcher{1} | ||||
|           </Original> | ||||
|           <Expanded> | ||||
|             std::exception special exception has value of 1 | ||||
|             SpecialException::what special exception has value of 1 | ||||
|           </Expanded> | ||||
|         </Expression> | ||||
|         <OverallResults successes="0" failures="2" expectedFailures="0"/> | ||||
| @@ -2004,7 +2004,7 @@ | ||||
|           throws(1), SpecialException, ExceptionMatcher{1} | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           std::exception special exception has value of 1 | ||||
|           SpecialException::what special exception has value of 1 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <Expression success="true" type="REQUIRE_THROWS_MATCHES" filename="projects/<exe-name>/UsageTests/Matchers.tests.cpp" > | ||||
| @@ -2012,7 +2012,7 @@ | ||||
|           throws(2), SpecialException, ExceptionMatcher{2} | ||||
|         </Original> | ||||
|         <Expanded> | ||||
|           std::exception special exception has value of 2 | ||||
|           SpecialException::what special exception has value of 2 | ||||
|         </Expanded> | ||||
|       </Expression> | ||||
|       <OverallResult success="true"/> | ||||
|   | ||||
| @@ -45,6 +45,10 @@ namespace { namespace MatchersTests { | ||||
|     struct SpecialException : std::exception { | ||||
|         SpecialException(int i_) : i(i_) {} | ||||
|  | ||||
|         char const* what() const noexcept override { | ||||
|             return "SpecialException::what"; | ||||
|         } | ||||
|  | ||||
|         int i; | ||||
|     }; | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský