catch2/include/internal/catch_result_builder.h
Phil Nash 9438a03d5b Big assertion capture refactoring.
- moved as much logic out of the macros as possible
- moved most logic into new ResultBuilder class, which wraps ExpressionResultBuilder (may take it over next), subsumes ResultAction and also takes place of ExpressionDecomposer.

This introduces many SRP violations - but all in the name of minimising macro logic!
2014-05-28 18:53:01 +01:00

50 lines
1.6 KiB
C++

/*
* Created by Phil on 28/5/2014.
* Copyright 2014 Two Blue Cubes Ltd. All rights reserved.
*
* 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)
*/
#ifndef TWOBLUECUBES_CATCH_RESULT_BUILDER_H_INCLUDED
#define TWOBLUECUBES_CATCH_RESULT_BUILDER_H_INCLUDED
#include "catch_expression_lhs.hpp"
#include "catch_expressionresult_builder.h"
#include "catch_common.h"
namespace Catch {
struct TestFailureException{};
struct ResultBuilder {
ResultBuilder( char const* macroName,
SourceLineInfo const& lineInfo,
char const* capturedExpression,
ResultDisposition::Flags resultDisposition );
template<typename T>
ExpressionLhs<T const&> operator->* ( T const& operand ) {
return ExpressionLhs<T const&>( *this, operand );
}
ExpressionLhs<bool> operator->* ( bool value ) {
return ExpressionLhs<bool>( *this, value );
}
void useActiveException( ResultDisposition::Flags resultDisposition = ResultDisposition::Normal );
void captureResult( ResultWas::OfType resultType );
void captureExpression();
void react();
bool shouldDebugBreak() const;
bool allowThrows() const;
AssertionInfo m_assertionInfo;
ExpressionResultBuilder m_resultBuilder;
bool m_shouldDebugBreak;
bool m_shouldThrow;
};
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_RESULT_BUILDER_H_INCLUDED