integrated INTERNAL_CHECK_THAT with new AssertionHandler

This commit is contained in:
Phil Nash
2017-08-08 23:31:43 +01:00
parent 2832e23aa9
commit 9668410b8e
2 changed files with 37 additions and 5 deletions

View File

@@ -144,6 +144,38 @@ namespace Catch {
}
};
// !TBD: this is just here temporarily
template<typename ArgT, typename MatcherT>
class MatchExpr : public ITransientExpression {
ArgT const& m_arg;
MatcherT const& m_matcher;
StringRef m_matcherString;
bool m_result;
public:
MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString )
: m_arg( arg ),
m_matcher( matcher ),
m_matcherString( matcherString ),
m_result( matcher.match( arg ) )
{}
auto isBinaryExpression() const -> bool override { return true; }
auto getResult() const -> bool override { return m_result; }
void streamReconstructedExpression( std::ostream &os ) const override {
auto matcherAsString = m_matcher.toString();
os << Catch::Detail::stringify( m_arg ) << ' ';
if( matcherAsString == Detail::unprintableString )
os << m_matcherString.c_str();
else
os << matcherAsString;
}
};
template<typename ArgT, typename MatcherT>
auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef matcherString ) -> MatchExpr<ArgT, MatcherT> {
return MatchExpr<ArgT, MatcherT>( arg, matcher, matcherString );
}
} // end namespace Catch
#endif // TWOBLUECUBES_CATCH_DECOMPOSER_H_INCLUDED