mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-04 05:59:32 +01:00 
			
		
		
		
	Remove isTrue, alwaysTrue, alwaysFalse
isTrue and alwaysFalse were replaced by (void)0, 0 inspired by doctest alwaysTrue was replaced by warning suppression
This commit is contained in:
		@@ -63,7 +63,7 @@
 | 
			
		||||
            CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \
 | 
			
		||||
        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::isTrue(false) && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
 | 
			
		||||
    } while( (void)0, 0 && static_cast<bool>( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look
 | 
			
		||||
    // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&.
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
@@ -88,7 +88,7 @@
 | 
			
		||||
            catchAssertionHandler.useActiveException(); \
 | 
			
		||||
        } \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \
 | 
			
		||||
@@ -105,7 +105,7 @@
 | 
			
		||||
        else \
 | 
			
		||||
            catchAssertionHandler.handle( Catch::ResultWas::Ok ); \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \
 | 
			
		||||
@@ -125,7 +125,7 @@
 | 
			
		||||
        else \
 | 
			
		||||
            catchAssertionHandler.handle( Catch::ResultWas::Ok ); \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
@@ -134,7 +134,7 @@
 | 
			
		||||
        Catch::AssertionHandler catchAssertionHandler( macroName, CATCH_INTERNAL_LINEINFO, "", resultDisposition ); \
 | 
			
		||||
        catchAssertionHandler.handle( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
#define INTERNAL_CATCH_INFO( macroName, log ) \
 | 
			
		||||
@@ -156,7 +156,7 @@
 | 
			
		||||
        else \
 | 
			
		||||
            catchAssertionHandler.handle( Catch::ResultWas::Ok ); \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
#endif // CATCH_CONFIG_DISABLE
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -63,7 +63,7 @@ namespace Catch {
 | 
			
		||||
            catchAssertionHandler.handle( Catch::makeMatchExpr( arg, matcher, #matcher ) ); \
 | 
			
		||||
        } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////////////////////////
 | 
			
		||||
@@ -84,6 +84,6 @@ namespace Catch {
 | 
			
		||||
        else \
 | 
			
		||||
            catchAssertionHandler.handle( Catch::ResultWas::Ok ); \
 | 
			
		||||
        INTERNAL_CATCH_REACT( catchAssertionHandler ) \
 | 
			
		||||
    } while( Catch::alwaysFalse() )
 | 
			
		||||
    } while( false )
 | 
			
		||||
 | 
			
		||||
#endif // TWOBLUECUBES_CATCH_CAPTURE_MATCHERS_HPP_INCLUDED
 | 
			
		||||
 
 | 
			
		||||
@@ -38,9 +38,6 @@ namespace Catch {
 | 
			
		||||
        return os;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    bool alwaysTrue() { return true; }
 | 
			
		||||
    bool alwaysFalse() { return false; }
 | 
			
		||||
 | 
			
		||||
    std::string StreamEndStop::operator+() const {
 | 
			
		||||
        return std::string();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -60,11 +60,6 @@ namespace Catch {
 | 
			
		||||
 | 
			
		||||
    std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info );
 | 
			
		||||
 | 
			
		||||
    // This is just here to avoid compiler warnings with macro constants and boolean literals
 | 
			
		||||
    inline bool isTrue( bool value ){ return value; }
 | 
			
		||||
    bool alwaysTrue();
 | 
			
		||||
    bool alwaysFalse();
 | 
			
		||||
 | 
			
		||||
    // Use this in variadic streaming macros to allow
 | 
			
		||||
    //    >> +StreamEndStop
 | 
			
		||||
    // as well as
 | 
			
		||||
 
 | 
			
		||||
@@ -40,7 +40,7 @@ namespace Catch {
 | 
			
		||||
#ifdef CATCH_TRAP
 | 
			
		||||
    #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); }
 | 
			
		||||
#else
 | 
			
		||||
    #define CATCH_BREAK_INTO_DEBUGGER() Catch::alwaysTrue();
 | 
			
		||||
    #define CATCH_BREAK_INTO_DEBUGGER() (void)0, 0
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#endif // TWOBLUECUBES_CATCH_DEBUGGER_H_INCLUDED
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user