AssertionResultBuilder -> ExpressionResultBuilder

This commit is contained in:
Phil Nash 2012-10-26 08:45:23 +01:00
parent 8cca2f1369
commit f847186ebb
9 changed files with 83 additions and 89 deletions

View File

@ -9,7 +9,7 @@
#define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_CAPTURE_HPP_INCLUDED
#include "catch_expression_decomposer.hpp" #include "catch_expression_decomposer.hpp"
#include "catch_assertionresult_builder.h" #include "catch_expressionresult_builder.h"
#include "catch_interfaces_capture.h" #include "catch_interfaces_capture.h"
#include "catch_debugger.hpp" #include "catch_debugger.hpp"
#include "catch_context.h" #include "catch_context.h"
@ -24,30 +24,30 @@ namespace Catch {
} }
template<typename MatcherT> template<typename MatcherT>
AssertionResultBuilder assertionBuilderFromMatcher( const MatcherT& matcher, ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher,
const std::string& matcherCallAsString ) { const std::string& matcherCallAsString ) {
std::string matcherAsString = matcher.toString(); std::string matcherAsString = matcher.toString();
if( matcherAsString == "{?}" ) if( matcherAsString == "{?}" )
matcherAsString = matcherCallAsString; matcherAsString = matcherCallAsString;
return AssertionResultBuilder() return ExpressionResultBuilder()
.setRhs( matcherAsString ) .setRhs( matcherAsString )
.setOp( "matches" ); .setOp( "matches" );
} }
template<typename MatcherT, typename ArgT> template<typename MatcherT, typename ArgT>
AssertionResultBuilder assertionBuilderFromMatcher( const MatcherT& matcher, ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher,
const ArgT& arg, const ArgT& arg,
const std::string& matcherCallAsString ) { const std::string& matcherCallAsString ) {
return assertionBuilderFromMatcher( matcher, matcherCallAsString ) return expressionResultBuilderFromMatcher( matcher, matcherCallAsString )
.setLhs( Catch::toString( arg ) ) .setLhs( Catch::toString( arg ) )
.setResultType( matcher.match( arg ) ); .setResultType( matcher.match( arg ) );
} }
template<typename MatcherT, typename ArgT> template<typename MatcherT, typename ArgT>
AssertionResultBuilder assertionBuilderFromMatcher( const MatcherT& matcher, ExpressionResultBuilder expressionResultBuilderFromMatcher( const MatcherT& matcher,
ArgT* arg, ArgT* arg,
const std::string& matcherCallAsString ) { const std::string& matcherCallAsString ) {
return assertionBuilderFromMatcher( matcher, matcherCallAsString ) return expressionResultBuilderFromMatcher( matcher, matcherCallAsString )
.setLhs( Catch::toString( arg ) ) .setLhs( Catch::toString( arg ) )
.setResultType( matcher.match( arg ) ); .setResultType( matcher.match( arg ) );
} }
@ -72,7 +72,7 @@ public:
} }
private: private:
AssertionResultBuilder m_resultBuilder; ExpressionResultBuilder m_resultBuilder;
}; };
// This is just here to avoid compiler warnings with macro constants and boolean literals // This is just here to avoid compiler warnings with macro constants and boolean literals
@ -101,7 +101,7 @@ inline bool isTrue( bool value ){ return value; }
} catch( Catch::TestFailureException& ) { \ } catch( Catch::TestFailureException& ) { \
throw; \ throw; \
} catch( ... ) { \ } catch( ... ) { \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::AssertionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), false, expr ); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), false, expr ); \
throw; \ throw; \
} } while( Catch::isTrue( false ) ) } } while( Catch::isTrue( false ) )
@ -120,10 +120,10 @@ inline bool isTrue( bool value ){ return value; }
try { \ try { \
INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \
expr; \ expr; \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::AssertionResultBuilder( Catch::ResultWas::Ok ), stopOnFailure, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), stopOnFailure, false ); \
} \ } \
catch( ... ) { \ catch( ... ) { \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::AssertionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), stopOnFailure, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException(), stopOnFailure, false ); \
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@ -132,26 +132,26 @@ inline bool isTrue( bool value ){ return value; }
INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \ INTERNAL_CATCH_ACCEPT_INFO( #expr, macroName, false ); \
if( Catch::getCurrentContext().getConfig()->allowThrows() ) { \ if( Catch::getCurrentContext().getConfig()->allowThrows() ) { \
expr; \ expr; \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::AssertionResultBuilder( Catch::ResultWas::DidntThrowException ), stopOnFailure, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::DidntThrowException ), stopOnFailure, false ); \
} \ } \
} \ } \
catch( Catch::TestFailureException& ) { \ catch( Catch::TestFailureException& ) { \
throw; \ throw; \
} \ } \
catch( exceptionType ) { \ catch( exceptionType ) { \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::AssertionResultBuilder( Catch::ResultWas::Ok ), stopOnFailure, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( Catch::ResultWas::Ok ), stopOnFailure, false ); \
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, stopOnFailure, macroName ) \ #define INTERNAL_CATCH_THROWS_AS( expr, exceptionType, stopOnFailure, macroName ) \
INTERNAL_CATCH_THROWS( expr, exceptionType, stopOnFailure, macroName ) \ INTERNAL_CATCH_THROWS( expr, exceptionType, stopOnFailure, macroName ) \
catch( ... ) { \ catch( ... ) { \
INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::AssertionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), stopOnFailure, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), stopOnFailure, false ); \
} }
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \ #define INTERNAL_CATCH_MSG( reason, resultType, stopOnFailure, macroName ) \
INTERNAL_CATCH_ACCEPT_EXPR( Catch::AssertionResultBuilder( resultType ) << reason, stopOnFailure, true ); INTERNAL_CATCH_ACCEPT_EXPR( Catch::ExpressionResultBuilder( resultType ) << reason, stopOnFailure, true );
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
#define INTERNAL_CATCH_SCOPED_INFO( log, macroName ) \ #define INTERNAL_CATCH_SCOPED_INFO( log, macroName ) \
@ -163,11 +163,11 @@ inline bool isTrue( bool value ){ return value; }
#define INTERNAL_CHECK_THAT( arg, matcher, stopOnFailure, macroName ) \ #define INTERNAL_CHECK_THAT( arg, matcher, stopOnFailure, macroName ) \
do { try { \ do { try { \
INTERNAL_CATCH_ACCEPT_INFO( #arg " " #matcher, macroName, false ) \ INTERNAL_CATCH_ACCEPT_INFO( #arg " " #matcher, macroName, false ) \
INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::assertionBuilderFromMatcher( ::Catch::Matchers::matcher, arg, #matcher ) ), stopOnFailure, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::expressionResultBuilderFromMatcher( ::Catch::Matchers::matcher, arg, #matcher ) ), stopOnFailure, false ); \
} catch( Catch::TestFailureException& ) { \ } catch( Catch::TestFailureException& ) { \
throw; \ throw; \
} catch( ... ) { \ } catch( ... ) { \
INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::AssertionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), false, false ); \ INTERNAL_CATCH_ACCEPT_EXPR( ( Catch::ExpressionResultBuilder( Catch::ResultWas::ThrewException ) << Catch::translateActiveException() ), false, false ); \
throw; \ throw; \
}}while( Catch::isTrue( false ) ) }}while( Catch::isTrue( false ) )

View File

@ -9,7 +9,6 @@
#define TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED #define TWOBLUECUBES_CATCH_EXPRESSION_DECOMPOSER_HPP_INCLUDED
#include "catch_expression_lhs.hpp" #include "catch_expression_lhs.hpp"
#include "catch_assertionresult_builder.h"
namespace Catch { namespace Catch {

View File

@ -5,17 +5,19 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying * Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef TWOBLUECUBES_CATCH_EXPRESSION_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_EXPRESSION_HPP_INCLUDED #define TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED
#include "catch_assertionresult_builder.h" #include "catch_expressionresult_builder.h"
#include "catch_evaluate.hpp" #include "catch_evaluate.hpp"
namespace Catch { namespace Catch {
struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison;
template<typename T> template<typename T>
inline void setResultIfBoolean( AssertionResultBuilder&, const T& ) {} inline void setResultIfBoolean( ExpressionResultBuilder&, const T& ) {}
inline void setResultIfBoolean( AssertionResultBuilder& result, bool value ) { inline void setResultIfBoolean( ExpressionResultBuilder& result, bool value ) {
result.setResultType( value ); result.setResultType( value );
} }
template<typename T> template<typename T>
@ -28,56 +30,57 @@ public:
} }
template<typename RhsT> template<typename RhsT>
AssertionResultBuilder& operator == ( const RhsT& rhs ) { ExpressionResultBuilder& operator == ( const RhsT& rhs ) {
return captureExpression<Internal::IsEqualTo>( rhs ); return captureExpression<Internal::IsEqualTo>( rhs );
} }
template<typename RhsT> template<typename RhsT>
AssertionResultBuilder& operator != ( const RhsT& rhs ) { ExpressionResultBuilder& operator != ( const RhsT& rhs ) {
return captureExpression<Internal::IsNotEqualTo>( rhs ); return captureExpression<Internal::IsNotEqualTo>( rhs );
} }
template<typename RhsT> template<typename RhsT>
AssertionResultBuilder& operator < ( const RhsT& rhs ) { ExpressionResultBuilder& operator < ( const RhsT& rhs ) {
return captureExpression<Internal::IsLessThan>( rhs ); return captureExpression<Internal::IsLessThan>( rhs );
} }
template<typename RhsT> template<typename RhsT>
AssertionResultBuilder& operator > ( const RhsT& rhs ) { ExpressionResultBuilder& operator > ( const RhsT& rhs ) {
return captureExpression<Internal::IsGreaterThan>( rhs ); return captureExpression<Internal::IsGreaterThan>( rhs );
} }
template<typename RhsT> template<typename RhsT>
AssertionResultBuilder& operator <= ( const RhsT& rhs ) { ExpressionResultBuilder& operator <= ( const RhsT& rhs ) {
return captureExpression<Internal::IsLessThanOrEqualTo>( rhs ); return captureExpression<Internal::IsLessThanOrEqualTo>( rhs );
} }
template<typename RhsT> template<typename RhsT>
AssertionResultBuilder& operator >= ( const RhsT& rhs ) { ExpressionResultBuilder& operator >= ( const RhsT& rhs ) {
return captureExpression<Internal::IsGreaterThanOrEqualTo>( rhs ); return captureExpression<Internal::IsGreaterThanOrEqualTo>( rhs );
} }
AssertionResultBuilder& operator == ( bool rhs ) { ExpressionResultBuilder& operator == ( bool rhs ) {
return captureExpression<Internal::IsEqualTo>( rhs ); return captureExpression<Internal::IsEqualTo>( rhs );
} }
AssertionResultBuilder& operator != ( bool rhs ) { ExpressionResultBuilder& operator != ( bool rhs ) {
return captureExpression<Internal::IsNotEqualTo>( rhs ); return captureExpression<Internal::IsNotEqualTo>( rhs );
} }
AssertionResultBuilder negate( bool shouldNegate ) { ExpressionResultBuilder negate( bool shouldNegate ) {
return m_result.negate( shouldNegate ); return m_result.negate( shouldNegate );
} }
template<typename RhsT> // Only simple binary expressions are allowed on the LHS.
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( const RhsT& ); // If more complex compositions are required then place the sub expression in parentheses
template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator + ( const RhsT& );
template<typename RhsT> template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( const RhsT& );
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator - ( const RhsT& ); template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator / ( const RhsT& );
template<typename RhsT> STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator * ( const RhsT& );
private: private:
template<Internal::Operator Op, typename RhsT> template<Internal::Operator Op, typename RhsT>
AssertionResultBuilder& captureExpression( const RhsT& rhs ) { ExpressionResultBuilder& captureExpression( const RhsT& rhs ) {
return m_result return m_result
.setResultType( Internal::compare<Op>( m_lhs, rhs ) ) .setResultType( Internal::compare<Op>( m_lhs, rhs ) )
.setRhs( Catch::toString( rhs ) ) .setRhs( Catch::toString( rhs ) )
@ -85,10 +88,10 @@ private:
} }
private: private:
AssertionResultBuilder m_result; ExpressionResultBuilder m_result;
T m_lhs; T m_lhs;
}; };
} // end namespace Catch } // end namespace Catch
#endif // TWOBLUECUBES_CATCH_EXPRESSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_EXPRESSION_LHS_HPP_INCLUDED

View File

@ -16,25 +16,23 @@
namespace Catch { namespace Catch {
struct STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison; class ExpressionResultBuilder {
class AssertionResultBuilder {
public: public:
AssertionResultBuilder( ResultWas::OfType resultType = ResultWas::Unknown ); ExpressionResultBuilder( ResultWas::OfType resultType = ResultWas::Unknown );
AssertionResultBuilder( const AssertionResultBuilder& other ); ExpressionResultBuilder( const ExpressionResultBuilder& other );
AssertionResultBuilder& operator=(const AssertionResultBuilder& other ); ExpressionResultBuilder& operator=(const ExpressionResultBuilder& other );
AssertionResultBuilder& setResultType( ResultWas::OfType result ); ExpressionResultBuilder& setResultType( ResultWas::OfType result );
AssertionResultBuilder& setResultType( bool result ); ExpressionResultBuilder& setResultType( bool result );
AssertionResultBuilder& setLhs( const std::string& lhs ); ExpressionResultBuilder& setLhs( const std::string& lhs );
AssertionResultBuilder& setRhs( const std::string& rhs ); ExpressionResultBuilder& setRhs( const std::string& rhs );
AssertionResultBuilder& setOp( const std::string& op ); ExpressionResultBuilder& setOp( const std::string& op );
AssertionResultBuilder& negate( bool shouldNegate ); ExpressionResultBuilder& negate( bool shouldNegate );
template<typename T> template<typename T>
AssertionResultBuilder& operator << ( const T& value ) { ExpressionResultBuilder& operator << ( const T& value ) {
m_stream << value; m_stream << value;
return *this; return *this;
} }
@ -43,12 +41,6 @@ public:
AssertionResultData build( const AssertionInfo& info ) const; AssertionResultData build( const AssertionInfo& info ) const;
// Disable attempts to use || and && in expressions (without parantheses)
template<typename RhsT>
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator || ( const RhsT& );
template<typename RhsT>
STATIC_ASSERT_Expression_Too_Complex_Please_Rewrite_As_Binary_Comparison& operator && ( const RhsT& );
private: private:
AssertionResultData m_data; AssertionResultData m_data;
struct ExprComponents { struct ExprComponents {

View File

@ -5,56 +5,56 @@
* Distributed under the Boost Software License, Version 1.0. (See accompanying * Distributed under the Boost Software License, Version 1.0. (See accompanying
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
*/ */
#ifndef TWOBLUECUBES_CATCH_ASSERTIONRESULT_BUILDER_HPP_INCLUDED #ifndef TWOBLUECUBES_CATCH_EXPRESSIONRESULT_BUILDER_HPP_INCLUDED
#define TWOBLUECUBES_CATCH_ASSERTIONRESULT_BUILDER_HPP_INCLUDED #define TWOBLUECUBES_CATCH_EXPRESSIONRESULT_BUILDER_HPP_INCLUDED
#include "catch_assertionresult_builder.h" #include "catch_expressionresult_builder.h"
#include <assert.h> #include <assert.h>
namespace Catch { namespace Catch {
AssertionResultBuilder::AssertionResultBuilder( ResultWas::OfType resultType ) { ExpressionResultBuilder::ExpressionResultBuilder( ResultWas::OfType resultType ) {
m_data.resultType = resultType; m_data.resultType = resultType;
} }
AssertionResultBuilder::AssertionResultBuilder( const AssertionResultBuilder& other ) ExpressionResultBuilder::ExpressionResultBuilder( const ExpressionResultBuilder& other )
: m_data( other.m_data ), : m_data( other.m_data ),
m_exprComponents( other.m_exprComponents ) m_exprComponents( other.m_exprComponents )
{ {
m_stream << other.m_stream.str(); m_stream << other.m_stream.str();
} }
AssertionResultBuilder& AssertionResultBuilder::operator=(const AssertionResultBuilder& other ) { ExpressionResultBuilder& ExpressionResultBuilder::operator=(const ExpressionResultBuilder& other ) {
m_data = other.m_data; m_data = other.m_data;
m_exprComponents = other.m_exprComponents; m_exprComponents = other.m_exprComponents;
m_stream.clear(); m_stream.clear();
m_stream << other.m_stream.str(); m_stream << other.m_stream.str();
return *this; return *this;
} }
AssertionResultBuilder& AssertionResultBuilder::setResultType( ResultWas::OfType result ) { ExpressionResultBuilder& ExpressionResultBuilder::setResultType( ResultWas::OfType result ) {
m_data.resultType = result; m_data.resultType = result;
return *this; return *this;
} }
AssertionResultBuilder& AssertionResultBuilder::setResultType( bool result ) { ExpressionResultBuilder& ExpressionResultBuilder::setResultType( bool result ) {
m_data.resultType = result ? ResultWas::Ok : ResultWas::ExpressionFailed; m_data.resultType = result ? ResultWas::Ok : ResultWas::ExpressionFailed;
return *this; return *this;
} }
AssertionResultBuilder& AssertionResultBuilder::negate( bool shouldNegate ) { ExpressionResultBuilder& ExpressionResultBuilder::negate( bool shouldNegate ) {
m_exprComponents.shouldNegate = shouldNegate; m_exprComponents.shouldNegate = shouldNegate;
return *this; return *this;
} }
AssertionResultBuilder& AssertionResultBuilder::setLhs( const std::string& lhs ) { ExpressionResultBuilder& ExpressionResultBuilder::setLhs( const std::string& lhs ) {
m_exprComponents.lhs = lhs; m_exprComponents.lhs = lhs;
return *this; return *this;
} }
AssertionResultBuilder& AssertionResultBuilder::setRhs( const std::string& rhs ) { ExpressionResultBuilder& ExpressionResultBuilder::setRhs( const std::string& rhs ) {
m_exprComponents.rhs = rhs; m_exprComponents.rhs = rhs;
return *this; return *this;
} }
AssertionResultBuilder& AssertionResultBuilder::setOp( const std::string& op ) { ExpressionResultBuilder& ExpressionResultBuilder::setOp( const std::string& op ) {
m_exprComponents.op = op; m_exprComponents.op = op;
return *this; return *this;
} }
AssertionResultData AssertionResultBuilder::build( const AssertionInfo& info ) const AssertionResultData ExpressionResultBuilder::build( const AssertionInfo& info ) const
{ {
assert( m_data.resultType != ResultWas::Unknown ); assert( m_data.resultType != ResultWas::Unknown );
@ -76,7 +76,7 @@ namespace Catch {
} }
return data; return data;
} }
std::string AssertionResultBuilder::reconstructExpression( const AssertionInfo& info ) const { std::string ExpressionResultBuilder::reconstructExpression( const AssertionInfo& info ) const {
if( m_exprComponents.op == "" ) if( m_exprComponents.op == "" )
return m_exprComponents.lhs.empty() ? info.capturedExpression : m_exprComponents.op + m_exprComponents.lhs; return m_exprComponents.lhs.empty() ? info.capturedExpression : m_exprComponents.op + m_exprComponents.lhs;
else if( m_exprComponents.op == "matches" ) else if( m_exprComponents.op == "matches" )
@ -95,4 +95,4 @@ namespace Catch {
} // end namespace Catch } // end namespace Catch
#endif // TWOBLUECUBES_CATCH_ASSERTIONRESULT_BUILDER_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_EXPRESSIONRESULT_BUILDER_HPP_INCLUDED

View File

@ -23,7 +23,7 @@
#include "catch_console_colour_impl.hpp" #include "catch_console_colour_impl.hpp"
#include "catch_generators_impl.hpp" #include "catch_generators_impl.hpp"
#include "catch_assertionresult.hpp" #include "catch_assertionresult.hpp"
#include "catch_assertionresult_builder.hpp" #include "catch_expressionresult_builder.hpp"
#include "catch_test_case_info.hpp" #include "catch_test_case_info.hpp"
#include "catch_tags.hpp" #include "catch_tags.hpp"

View File

@ -17,7 +17,7 @@ namespace Catch {
class TestCaseInfo; class TestCaseInfo;
class ScopedInfo; class ScopedInfo;
class AssertionResultBuilder; class ExpressionResultBuilder;
class AssertionResult; class AssertionResult;
struct AssertionInfo; struct AssertionInfo;
@ -36,7 +36,7 @@ namespace Catch {
virtual bool shouldDebugBreak() const = 0; virtual bool shouldDebugBreak() const = 0;
virtual void acceptAssertionInfo( const AssertionInfo& assertionInfo ) = 0; virtual void acceptAssertionInfo( const AssertionInfo& assertionInfo ) = 0;
virtual ResultAction::Value acceptExpression( const AssertionResultBuilder& assertionResult ) = 0; virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult ) = 0;
virtual std::string getCurrentTestName() const = 0; virtual std::string getCurrentTestName() const = 0;
virtual const AssertionResult* getLastResult() const = 0; virtual const AssertionResult* getLastResult() const = 0;

View File

@ -135,7 +135,7 @@ namespace Catch {
m_assertionInfo = assertionInfo; m_assertionInfo = assertionInfo;
} }
virtual ResultAction::Value acceptExpression( const AssertionResultBuilder& assertionResult ) { virtual ResultAction::Value acceptExpression( const ExpressionResultBuilder& assertionResult ) {
m_currentResult = assertionResult; m_currentResult = assertionResult;
return actOnCurrentResult(); return actOnCurrentResult();
} }
@ -236,7 +236,7 @@ namespace Catch {
m_lastResult = AssertionResult( m_assertionInfo, m_currentResult.build( m_assertionInfo ) ); m_lastResult = AssertionResult( m_assertionInfo, m_currentResult.build( m_assertionInfo ) );
testEnded( m_lastResult ); testEnded( m_lastResult );
m_currentResult = AssertionResultBuilder(); m_currentResult = ExpressionResultBuilder();
m_assertionInfo = AssertionInfo(); m_assertionInfo = AssertionInfo();
ResultAction::Value action = ResultAction::None; ResultAction::Value action = ResultAction::None;
@ -287,7 +287,7 @@ namespace Catch {
private: private:
IMutableContext& m_context; IMutableContext& m_context;
RunningTest* m_runningTest; RunningTest* m_runningTest;
AssertionResultBuilder m_currentResult; ExpressionResultBuilder m_currentResult;
AssertionResult m_lastResult; AssertionResult m_lastResult;
const Config& m_config; const Config& m_config;

View File

@ -121,9 +121,9 @@
4A8E4DD0160A352200194CBD /* catch_tags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_tags.cpp; path = ../../../SelfTest/SurrogateCpps/catch_tags.cpp; sourceTree = "<group>"; }; 4A8E4DD0160A352200194CBD /* catch_tags.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_tags.cpp; path = ../../../SelfTest/SurrogateCpps/catch_tags.cpp; sourceTree = "<group>"; };
4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_generators.h; sourceTree = "<group>"; }; 4A90B59B15D0F61A00EF71BC /* catch_interfaces_generators.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_interfaces_generators.h; sourceTree = "<group>"; };
4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_assertionresult.hpp; sourceTree = "<group>"; }; 4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_assertionresult.hpp; sourceTree = "<group>"; };
4A90B59E15D2521E00EF71BC /* catch_assertionresult_builder.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_assertionresult_builder.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; }; 4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_expressionresult_builder.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_tostring.hpp; sourceTree = "<group>"; }; 4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_tostring.hpp; sourceTree = "<group>"; };
4A9D84B315599AC900FBB209 /* catch_assertionresult_builder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_assertionresult_builder.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; }; 4A9D84B315599AC900FBB209 /* catch_expressionresult_builder.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_expressionresult_builder.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
4AA7FF4115F3E89D009AD7F9 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BDDTests.cpp; sourceTree = "<group>"; }; 4AA7FF4115F3E89D009AD7F9 /* BDDTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BDDTests.cpp; sourceTree = "<group>"; };
4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_console_colour_impl.hpp; sourceTree = "<group>"; }; 4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_console_colour_impl.hpp; sourceTree = "<group>"; };
4AB1C73714F97C1300F31DF7 /* catch_console_colour.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_console_colour.hpp; sourceTree = "<group>"; }; 4AB1C73714F97C1300F31DF7 /* catch_console_colour.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_console_colour.hpp; sourceTree = "<group>"; };
@ -276,7 +276,7 @@
4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */, 4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */,
4A4B0F9B15CEF8C400AE2392 /* catch_notimplemented_exception.hpp */, 4A4B0F9B15CEF8C400AE2392 /* catch_notimplemented_exception.hpp */,
4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */, 4A90B59D15D24FE900EF71BC /* catch_assertionresult.hpp */,
4A90B59E15D2521E00EF71BC /* catch_assertionresult_builder.hpp */, 4A90B59E15D2521E00EF71BC /* catch_expressionresult_builder.hpp */,
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */, 4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */,
); );
name = impl; name = impl;
@ -289,7 +289,7 @@
4A6D0C4F149B3E3D00DB3EAA /* catch_generators.hpp */, 4A6D0C4F149B3E3D00DB3EAA /* catch_generators.hpp */,
4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */, 4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */,
4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */, 4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */,
4A9D84B315599AC900FBB209 /* catch_assertionresult_builder.h */, 4A9D84B315599AC900FBB209 /* catch_expressionresult_builder.h */,
4A6D0C5F149B3E3D00DB3EAA /* catch_section.hpp */, 4A6D0C5F149B3E3D00DB3EAA /* catch_section.hpp */,
4A3D7DD01503869D005F9203 /* catch_matchers.hpp */, 4A3D7DD01503869D005F9203 /* catch_matchers.hpp */,
4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */, 4A9D84B11558FC0400FBB209 /* catch_tostring.hpp */,