Compare commits

..

3 Commits

Author SHA1 Message Date
Phil Nash
92356769f1 dev build 2 2015-11-06 18:07:29 +00:00
Phil Nash
d10b73f9f1 changed Not struct to a class.
- it was forward declared as a class, which caused warnings on some compilers. It should really have been a class anyway.
- this addresses the same issue as PR #534, albeit from the other angle.
2015-11-06 18:07:29 +00:00
Phil Nash
71fd2c2fdf Fixed test names mentioning the new Matcher combinator operators 2015-11-06 18:07:28 +00:00
9 changed files with 28 additions and 26 deletions

View File

@@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.3.0-develop.1* *v1.3.0-develop.2*
Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch) Build status (on Travis CI) [![Build Status](https://travis-ci.org/philsquared/Catch.png)](https://travis-ci.org/philsquared/Catch)

View File

@@ -43,7 +43,8 @@ namespace Matchers {
namespace Generic { namespace Generic {
template<typename ExpressionT> template<typename ExpressionT>
struct Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> { class Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
public:
explicit 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 ) {} Not( Not const& other ) : m_matcher( other.m_matcher ) {}
@@ -54,7 +55,7 @@ namespace Matchers {
virtual std::string toString() const CATCH_OVERRIDE { virtual std::string toString() const CATCH_OVERRIDE {
return "not " + m_matcher->toString(); return "not " + m_matcher->toString();
} }
private:
Ptr< Matcher<ExpressionT> > m_matcher; Ptr< Matcher<ExpressionT> > m_matcher;
}; };

View File

@@ -37,7 +37,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 3, 0, "develop", 1 ); Version libraryVersion( 1, 3, 0, "develop", 2 );
} }

View File

@@ -708,7 +708,7 @@ with expansion:
"this string contains 'abc' as a substring" equals: "something else" "this string contains 'abc' as a substring" equals: "something else"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Matchers can be composed with both + and | - failing Matchers can be composed with both && and || - failing
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................

View File

@@ -3419,7 +3419,7 @@ with expansion:
'abc' as a substring" 'abc' as a substring"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Matchers can be (AllOf) composed with the + operator Matchers can be (AllOf) composed with the && operator
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@@ -3432,7 +3432,7 @@ with expansion:
contains: "abc" and contains: "substring" and contains: "contains" ) contains: "abc" and contains: "substring" and contains: "contains" )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Matchers can be (AnyOf) composed with the | operator Matchers can be (AnyOf) composed with the || operator
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@@ -3452,7 +3452,7 @@ with expansion:
"string" or contains: "different" or contains: "random" ) "string" or contains: "different" or contains: "random" )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Matchers can be composed with both + and | Matchers can be composed with both && and ||
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................
@@ -3465,7 +3465,7 @@ with expansion:
contains: "different" ) and contains: "substring" ) contains: "different" ) and contains: "substring" )
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Matchers can be composed with both + and | - failing Matchers can be composed with both && and || - failing
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
............................................................................... ...............................................................................

View File

@@ -438,10 +438,10 @@ MiscTests.cpp:<line number>
<testcase classname="global" name="AllOf matcher" time="{duration}"/> <testcase classname="global" name="AllOf matcher" time="{duration}"/>
<testcase classname="global" name="AnyOf matcher" time="{duration}"/> <testcase classname="global" name="AnyOf matcher" time="{duration}"/>
<testcase classname="global" name="Equals" time="{duration}"/> <testcase classname="global" name="Equals" time="{duration}"/>
<testcase classname="global" name="Matchers can be (AllOf) composed with the + operator" time="{duration}"/> <testcase classname="global" name="Matchers can be (AllOf) composed with the &amp;&amp; operator" time="{duration}"/>
<testcase classname="global" name="Matchers can be (AnyOf) composed with the | operator" time="{duration}"/> <testcase classname="global" name="Matchers can be (AnyOf) composed with the || operator" time="{duration}"/>
<testcase classname="global" name="Matchers can be composed with both + and |" time="{duration}"/> <testcase classname="global" name="Matchers can be composed with both &amp;&amp; and ||" time="{duration}"/>
<testcase classname="global" name="Matchers can be composed with both + and | - failing" time="{duration}"> <testcase classname="global" name="Matchers can be composed with both &amp;&amp; and || - failing" time="{duration}">
<failure message="&quot;this string contains 'abc' as a substring&quot; ( ( contains: &quot;string&quot; or contains: &quot;different&quot; ) and contains: &quot;random&quot; )" type="CHECK_THAT"> <failure message="&quot;this string contains 'abc' as a substring&quot; ( ( contains: &quot;string&quot; or contains: &quot;different&quot; ) and contains: &quot;random&quot; )" type="CHECK_THAT">
MiscTests.cpp:<line number> MiscTests.cpp:<line number>
</failure> </failure>

View File

@@ -3590,7 +3590,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Matchers can be (AllOf) composed with the + operator"> <TestCase name="Matchers can be (AllOf) composed with the &amp;&amp; operator">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "string" ) &amp;&amp; Contains( "abc" ) &amp;&amp; Contains( "substring" ) &amp;&amp; Contains( "contains" ) testStringForMatching() Contains( "string" ) &amp;&amp; Contains( "abc" ) &amp;&amp; Contains( "substring" ) &amp;&amp; Contains( "contains" )
@@ -3601,7 +3601,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Matchers can be (AnyOf) composed with the | operator"> <TestCase name="Matchers can be (AnyOf) composed with the || operator">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() Contains( "string" ) || Contains( "different" ) || Contains( "random" ) testStringForMatching() Contains( "string" ) || Contains( "different" ) || Contains( "random" )
@@ -3620,7 +3620,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Matchers can be composed with both + and |"> <TestCase name="Matchers can be composed with both &amp;&amp; and ||">
<Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="true" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "substring" ) testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "substring" )
@@ -3631,7 +3631,7 @@
</Expression> </Expression>
<OverallResult success="true"/> <OverallResult success="true"/>
</TestCase> </TestCase>
<TestCase name="Matchers can be composed with both + and | - failing"> <TestCase name="Matchers can be composed with both &amp;&amp; and || - failing">
<Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" > <Expression success="false" type="CHECK_THAT" filename="projects/SelfTest/MiscTests.cpp" >
<Original> <Original>
testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "random" ) testStringForMatching() ( Contains( "string" ) || Contains( "different" ) ) &amp;&amp; Contains( "random" )

View File

@@ -262,7 +262,7 @@ TEST_CASE("Equals", "[matchers]")
CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) ); CHECK_THAT( testStringForMatching(), Equals( "this string contains 'abc' as a substring" ) );
} }
TEST_CASE("Matchers can be (AllOf) composed with the + operator", "[matchers][operators][operator+]") TEST_CASE("Matchers can be (AllOf) composed with the && operator", "[matchers][operators][operator&&]")
{ {
CHECK_THAT( testStringForMatching(), CHECK_THAT( testStringForMatching(),
Contains( "string" ) && Contains( "string" ) &&
@@ -271,18 +271,18 @@ TEST_CASE("Matchers can be (AllOf) composed with the + operator", "[matchers][op
Contains( "contains" ) ); Contains( "contains" ) );
} }
TEST_CASE("Matchers can be (AnyOf) composed with the | operator", "[matchers][operators][operator|]") TEST_CASE("Matchers can be (AnyOf) composed with the || operator", "[matchers][operators][operator||]")
{ {
CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ); CHECK_THAT( testStringForMatching(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) );
CHECK_THAT( testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) ); CHECK_THAT( testStringForMatching2(), Contains( "string" ) || Contains( "different" ) || Contains( "random" ) );
} }
TEST_CASE("Matchers can be composed with both + and |", "[matchers][operators][operator|][operator+]") TEST_CASE("Matchers can be composed with both && and ||", "[matchers][operators][operator||][operator&&]")
{ {
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) ); CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "substring" ) );
} }
TEST_CASE("Matchers can be composed with both + and | - failing", "[matchers][operators][operator|][operator+][.failing]") TEST_CASE("Matchers can be composed with both && and || - failing", "[matchers][operators][operator||][operator&&][.failing]")
{ {
CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) ); CHECK_THAT( testStringForMatching(), ( Contains( "string" ) || Contains( "different" ) ) && Contains( "random" ) );
} }

View File

@@ -1,6 +1,6 @@
/* /*
* Catch v1.3.0-develop.1 * Catch v1.3.0-develop.2
* Generated: 2015-11-05 18:47:08.462966 * Generated: 2015-11-06 18:05:44.676531
* ---------------------------------------------------------- * ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly * This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved. * Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@@ -862,7 +862,8 @@ namespace Matchers {
namespace Generic { namespace Generic {
template<typename ExpressionT> template<typename ExpressionT>
struct Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> { class Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
public:
explicit 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 ) {} Not( Not const& other ) : m_matcher( other.m_matcher ) {}
@@ -873,7 +874,7 @@ namespace Matchers {
virtual std::string toString() const CATCH_OVERRIDE { virtual std::string toString() const CATCH_OVERRIDE {
return "not " + m_matcher->toString(); return "not " + m_matcher->toString();
} }
private:
Ptr< Matcher<ExpressionT> > m_matcher; Ptr< Matcher<ExpressionT> > m_matcher;
}; };
@@ -7238,7 +7239,7 @@ namespace Catch {
return os; return os;
} }
Version libraryVersion( 1, 3, 0, "develop", 1 ); Version libraryVersion( 1, 3, 0, "develop", 2 );
} }