mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-10-31 20:27:11 +01:00 
			
		
		
		
	Workaround raw string literal bug in VS2017
This commit is contained in:
		| @@ -12,6 +12,11 @@ | ||||
| #include "catch_message.h" | ||||
| #include "catch_interfaces_capture.h" | ||||
|  | ||||
| #if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) | ||||
|   #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ | ||||
| #else | ||||
|   #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" | ||||
| #endif | ||||
|  | ||||
| #if defined(CATCH_CONFIG_FAST_COMPILE) | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| @@ -50,7 +55,7 @@ | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| #define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition ); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ | ||||
|         INTERNAL_CATCH_TRY( catchAssertionHandler ) { \ | ||||
|             CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ | ||||
|             catchAssertionHandler.handle( Catch::Decomposer() <= __VA_ARGS__ ); \ | ||||
| @@ -73,7 +78,7 @@ | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| #define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition ); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ | ||||
|         try { \ | ||||
|             static_cast<void>(__VA_ARGS__); \ | ||||
|             catchAssertionHandler.handle( Catch::ResultWas::Ok ); \ | ||||
| @@ -87,7 +92,7 @@ | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| #define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__, resultDisposition); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ | ||||
|         if( catchAssertionHandler.allowThrows() ) \ | ||||
|             try { \ | ||||
|                 static_cast<void>(__VA_ARGS__); \ | ||||
| @@ -104,7 +109,7 @@ | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| #define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #expr ", " #exceptionType, resultDisposition ); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ | ||||
|         if( catchAssertionHandler.allowThrows() ) \ | ||||
|             try { \ | ||||
|                 static_cast<void>(expr); \ | ||||
| @@ -138,7 +143,7 @@ | ||||
| // Although this is matcher-based, it can be used with just a string | ||||
| #define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__ ", " #matcher, resultDisposition ); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ | ||||
|         if( catchAssertionHandler.allowThrows() ) \ | ||||
|             try { \ | ||||
|                 static_cast<void>(__VA_ARGS__); \ | ||||
|   | ||||
| @@ -57,7 +57,7 @@ namespace Catch { | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| #define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #arg ", " #matcher, resultDisposition ); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ | ||||
|         INTERNAL_CATCH_TRY( catchAssertionHandler ) { \ | ||||
|             catchAssertionHandler.handle( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \ | ||||
|         } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ | ||||
| @@ -68,7 +68,7 @@ namespace Catch { | ||||
| /////////////////////////////////////////////////////////////////////////////// | ||||
| #define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \ | ||||
|     do { \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, #__VA_ARGS__ ", " #exceptionType ", " #matcher, resultDisposition ); \ | ||||
|         Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ | ||||
|         if( catchAssertionHandler.allowThrows() ) \ | ||||
|             try { \ | ||||
|                 static_cast<void>(__VA_ARGS__ ); \ | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Martin Hořeňovský
					Martin Hořeňovský