Skip to content

Commit

Permalink
build 1.3.0-develop.1
Browse files Browse the repository at this point in the history
I've incremented the minor release number. This is a slight abuse of semantic versioning so let me explain:
I've slightly changed how matchers are used. The matcher macro (REQUIRE_THAT/ CHECK_THAT) used to introduce the Catch::Matchers namespace before the macro token for the matcher, to save you having import the namespace yourself.
The trouble is if the matcher token is not a simple matcher (can now be an expression) this breaks!
So I've removed that qualification. Now if you use Matchers you'll have to do somethings like using namespace Catch::Matchers to bring them in.
This is a breaking change - but, OTTOH, Matchers are an undocumented "beta' feature that I've stated in the past is not guaranteed to have a stable API - so I don't think this warrants a major version change - but I did want to make it significant enough that people do notice that something is going on - and perhaps lead them to this commit message.
  • Loading branch information
philsquared committed Nov 5, 2015
1 parent 054e3c5 commit 08844e7
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 9 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png)

*v1.2.1-develop.16*
*v1.3.0-develop.1*

Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

Expand Down
2 changes: 1 addition & 1 deletion include/internal/catch_version.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ namespace Catch {
return os;
}

Version libraryVersion( 1, 2, 1, "develop", 16 );
Version libraryVersion( 1, 3, 0, "develop", 1 );

}

Expand Down
58 changes: 51 additions & 7 deletions single_include/catch.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Catch v1.2.1-develop.16
* Generated: 2015-11-03 17:37:18.144715
* Catch v1.3.0-develop.1
* Generated: 2015-11-05 18:47:08.462966
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
Expand Down Expand Up @@ -831,6 +831,12 @@ namespace Catch {
namespace Matchers {
namespace Impl {

namespace Generic {
template<typename ExpressionT> class AllOf;
template<typename ExpressionT> class AnyOf;
template<typename ExpressionT> class Not;
}

template<typename ExpressionT>
struct Matcher : SharedImpl<IShared>
{
Expand All @@ -840,6 +846,10 @@ namespace Matchers {
virtual Ptr<Matcher> clone() const = 0;
virtual bool match( ExpressionT const& expr ) const = 0;
virtual std::string toString() const = 0;

Generic::AllOf<ExpressionT> operator && ( Matcher<ExpressionT> const& other ) const;
Generic::AnyOf<ExpressionT> operator || ( Matcher<ExpressionT> const& other ) const;
Generic::Not<ExpressionT> operator ! () const;
};

template<typename DerivedT, typename ExpressionT>
Expand All @@ -853,7 +863,7 @@ namespace Matchers {
namespace Generic {
template<typename ExpressionT>
struct Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
explicit Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
Not( Not const& other ) : m_matcher( other.m_matcher ) {}

virtual bool match( ExpressionT const& expr ) const CATCH_OVERRIDE {
Expand Down Expand Up @@ -897,6 +907,12 @@ namespace Matchers {
return oss.str();
}

AllOf operator && ( Matcher<ExpressionT> const& other ) const {
AllOf allOfExpr( *this );
allOfExpr.add( other );
return allOfExpr;
}

private:
std::vector<Ptr<Matcher<ExpressionT> > > m_matchers;
};
Expand Down Expand Up @@ -931,9 +947,37 @@ namespace Matchers {
return oss.str();
}

AnyOf operator || ( Matcher<ExpressionT> const& other ) const {
AnyOf anyOfExpr( *this );
anyOfExpr.add( other );
return anyOfExpr;
}

private:
std::vector<Ptr<Matcher<ExpressionT> > > m_matchers;
};

} // namespace Generic

template<typename ExpressionT>
Generic::AllOf<ExpressionT> Matcher<ExpressionT>::operator && ( Matcher<ExpressionT> const& other ) const {
Generic::AllOf<ExpressionT> allOfExpr;
allOfExpr.add( *this );
allOfExpr.add( other );
return allOfExpr;
}

template<typename ExpressionT>
Generic::AnyOf<ExpressionT> Matcher<ExpressionT>::operator || ( Matcher<ExpressionT> const& other ) const {
Generic::AnyOf<ExpressionT> anyOfExpr;
anyOfExpr.add( *this );
anyOfExpr.add( other );
return anyOfExpr;
}

template<typename ExpressionT>
Generic::Not<ExpressionT> Matcher<ExpressionT>::operator ! () const {
return Generic::Not<ExpressionT>( *this );
}

namespace StdString {
Expand Down Expand Up @@ -2055,12 +2099,12 @@ namespace Catch {
do { \
Catch::ResultBuilder __catchResult( macroName, CATCH_INTERNAL_LINEINFO, #arg " " #matcher, resultDisposition ); \
try { \
std::string matcherAsString = ::Catch::Matchers::matcher.toString(); \
std::string matcherAsString = (matcher).toString(); \
__catchResult \
.setLhs( Catch::toString( arg ) ) \
.setRhs( matcherAsString == Catch::Detail::unprintableString ? #matcher : matcherAsString ) \
.setOp( "matches" ) \
.setResultType( ::Catch::Matchers::matcher.match( arg ) ); \
.setResultType( (matcher).match( arg ) ); \
__catchResult.captureExpression(); \
} catch( ... ) { \
__catchResult.useActiveException( resultDisposition | Catch::ResultDisposition::ContinueOnFailure ); \
Expand Down Expand Up @@ -7194,7 +7238,7 @@ namespace Catch {
return os;
}

Version libraryVersion( 1, 2, 1, "develop", 16 );
Version libraryVersion( 1, 3, 0, "develop", 1 );

}

Expand Down Expand Up @@ -8429,7 +8473,7 @@ namespace Catch {
{}

virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {}
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
virtual bool assertionEnded( AssertionStats const& ) CATCH_OVERRIDE {
return false;
}
};
Expand Down

0 comments on commit 08844e7

Please sign in to comment.