dev build 7

This commit is contained in:
Phil Nash 2015-07-13 15:03:26 +01:00
parent 2104ca2aa4
commit 8342ae8dfb
3 changed files with 80 additions and 44 deletions

View File

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

View File

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

View File

@ -1,6 +1,6 @@
/*
* Catch v1.2.1-develop.6
* Generated: 2015-07-13 06:35:13.441019
* Catch v1.2.1-develop.7
* Generated: 2015-07-13 15:03:15.644872
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2012 Two Blue Cubes Ltd. All rights reserved.
@ -2838,6 +2838,71 @@ return @ desc; \
#pragma clang diagnostic ignored "-Wpadded"
#endif
// #included from: catch_wildcard_pattern.hpp
#define TWOBLUECUBES_CATCH_WILDCARD_PATTERN_HPP_INCLUDED
namespace Catch
{
class WildcardPattern {
enum WildcardPosition {
NoWildcard = 0,
WildcardAtStart = 1,
WildcardAtEnd = 2,
WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
};
public:
enum CaseSensitivity {
CaseSensitive,
CaseInsensitive
};
WildcardPattern( std::string const& pattern, CaseSensitivity caseSensitivity )
: m_caseSensitivity( caseSensitivity ),
m_wildcard( NoWildcard ),
m_pattern( adjustCase( pattern ) )
{
if( startsWith( m_pattern, "*" ) ) {
m_pattern = m_pattern.substr( 1 );
m_wildcard = WildcardAtStart;
}
if( endsWith( m_pattern, "*" ) ) {
m_pattern = m_pattern.substr( 0, m_pattern.size()-1 );
m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
}
}
virtual ~WildcardPattern();
virtual bool matches( std::string const& str ) const {
switch( m_wildcard ) {
case NoWildcard:
return m_pattern == adjustCase( str );
case WildcardAtStart:
return endsWith( adjustCase( str ), m_pattern );
case WildcardAtEnd:
return startsWith( adjustCase( str ), m_pattern );
case WildcardAtBothEnds:
return contains( adjustCase( str ), m_pattern );
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#endif
throw std::logic_error( "Unknown enum" );
#ifdef __clang__
#pragma clang diagnostic pop
#endif
}
private:
std::string adjustCase( std::string const& str ) const {
return m_caseSensitivity == CaseInsensitive ? toLower( str ) : str;
}
CaseSensitivity m_caseSensitivity;
WildcardPosition m_wildcard;
std::string m_pattern;
};
}
#include <string>
#include <vector>
@ -2849,50 +2914,18 @@ namespace Catch {
virtual bool matches( TestCaseInfo const& testCase ) const = 0;
};
class NamePattern : public Pattern {
enum WildcardPosition {
NoWildcard = 0,
WildcardAtStart = 1,
WildcardAtEnd = 2,
WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd
};
public:
NamePattern( std::string const& name ) : m_name( toLower( name ) ), m_wildcard( NoWildcard ) {
if( startsWith( m_name, "*" ) ) {
m_name = m_name.substr( 1 );
m_wildcard = WildcardAtStart;
}
if( endsWith( m_name, "*" ) ) {
m_name = m_name.substr( 0, m_name.size()-1 );
m_wildcard = static_cast<WildcardPosition>( m_wildcard | WildcardAtEnd );
}
}
NamePattern( std::string const& name )
: m_wildcardPattern( toLower( name ), WildcardPattern::CaseInsensitive )
{}
virtual ~NamePattern();
virtual bool matches( TestCaseInfo const& testCase ) const {
switch( m_wildcard ) {
case NoWildcard:
return m_name == toLower( testCase.name );
case WildcardAtStart:
return endsWith( toLower( testCase.name ), m_name );
case WildcardAtEnd:
return startsWith( toLower( testCase.name ), m_name );
case WildcardAtBothEnds:
return contains( toLower( testCase.name ), m_name );
}
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunreachable-code"
#endif
throw std::logic_error( "Unknown enum" );
#ifdef __clang__
#pragma clang diagnostic pop
#endif
return m_wildcardPattern.matches( toLower( testCase.name ) );
}
private:
std::string m_name;
WildcardPosition m_wildcard;
WildcardPattern m_wildcardPattern;
};
class TagPattern : public Pattern {
public:
TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {}
@ -2903,6 +2936,7 @@ namespace Catch {
private:
std::string m_tag;
};
class ExcludedPattern : public Pattern {
public:
ExcludedPattern( Ptr<Pattern> const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {}
@ -6827,7 +6861,7 @@ namespace Catch {
return os;
}
Version libraryVersion( 1, 2, 1, "develop", 6 );
Version libraryVersion( 1, 2, 1, "develop", 7 );
}
@ -7504,7 +7538,8 @@ namespace Catch {
if( expectedMessage != "" ) {
std::string actualMessage = Catch::translateActiveException();
if( expectedMessage != actualMessage ) {
WildcardPattern pattern( expectedMessage, WildcardPattern::CaseInsensitive );
if( !pattern.matches( actualMessage ) ) {
data.resultType = ResultWas::ExpressionFailed;
data.reconstructedExpression = actualMessage;
}
@ -9299,6 +9334,7 @@ namespace Catch {
FreeFunctionTestCase::~FreeFunctionTestCase() {}
IGeneratorInfo::~IGeneratorInfo() {}
IGeneratorsForTest::~IGeneratorsForTest() {}
WildcardPattern::~WildcardPattern() {}
TestSpec::Pattern::~Pattern() {}
TestSpec::NamePattern::~NamePattern() {}
TestSpec::TagPattern::~TagPattern() {}