This commit is contained in:
Phil Nash 2013-03-25 09:25:31 +00:00
parent 016b063ae8
commit dd26e889b5
4 changed files with 47 additions and 24 deletions

View File

@ -1,6 +1,6 @@
![catch logo](https://raw.github.com/philsquared/Catch/Integration/catch-logo-small.png) ![catch logo](https://raw.github.com/philsquared/Catch/Integration/catch-logo-small.png)
## CATCH v0.9 build 27 (integration branch) ## CATCH v0.9 build 28 (integration branch)
An automated test framework for C, C++ and Objective-C. An automated test framework for C, C++ and Objective-C.
This branch may contain code that is experimental or not yet fully tested. This branch may contain code that is experimental or not yet fully tested.

View File

@ -45,9 +45,9 @@ namespace Catch {
if( matchesFilters( config.filters, *it ) ) { if( matchesFilters( config.filters, *it ) ) {
matchedTests++; matchedTests++;
// !TBD: consider listAs() // !TBD: consider listAs()
std::cout << "\t" << it->getTestCaseInfo().name << "\n"; std::cout << " " << it->getTestCaseInfo().name << "\n";
if( ( config.listSpec & List::TestNames ) != List::TestNames ) if( ( config.listSpec & List::TestNames ) != List::TestNames )
std::cout << "\t\t '" << it->getTestCaseInfo().description << "'\n"; std::cout << " '" << it->getTestCaseInfo().description << "'\n";
} }
} }
if( config.filters.empty() ) if( config.filters.empty() )

View File

@ -13,7 +13,7 @@
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 0, 9, 27, "integration" ); Version libraryVersion( 0, 9, 28, "integration" );
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v0.9 build 27 (integration branch) * CATCH v0.9 build 28 (integration branch)
* Generated: 2013-03-21 08:59:28.031778 * Generated: 2013-03-25 09:25:14.678493
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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.
@ -107,9 +107,14 @@ namespace Catch {
inline bool contains( const std::string& s, const std::string& infix ) { inline bool contains( const std::string& s, const std::string& infix ) {
return s.find( infix ) != std::string::npos; return s.find( infix ) != std::string::npos;
} }
inline void toLower( std::string& s ) { inline void toLowerInPlace( std::string& s ) {
std::transform( s.begin(), s.end(), s.begin(), ::tolower ); std::transform( s.begin(), s.end(), s.begin(), ::tolower );
} }
inline std::string toLower( std::string const& s ) {
std::string lc = s;
toLowerInPlace( lc );
return lc;
}
struct pluralise { struct pluralise {
pluralise( std::size_t count, const std::string& label ) pluralise( std::size_t count, const std::string& label )
@ -825,6 +830,11 @@ namespace Catch {
// #included from: catch_evaluate.hpp // #included from: catch_evaluate.hpp
#define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED #define TWOBLUECUBES_CATCH_EVALUATE_HPP_INCLUDED
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable:4389) // '==' : signed/unsigned mismatch
#endif
namespace Catch { namespace Catch {
namespace Internal { namespace Internal {
@ -964,6 +974,10 @@ namespace Internal {
} // end of namespace Internal } // end of namespace Internal
} // end of namespace Catch } // end of namespace Catch
#ifdef _MSC_VER
#pragma warning(pop)
#endif
namespace Catch { namespace Catch {
// Wraps the (stringised versions of) the lhs, operator and rhs of an expression - as well as // Wraps the (stringised versions of) the lhs, operator and rhs of an expression - as well as
@ -1507,9 +1521,7 @@ namespace Catch {
private: private:
virtual void acceptTag( const std::string& tag ) { virtual void acceptTag( const std::string& tag ) {
std::string lcTag = tag; m_tags.insert( toLower( tag ) );
toLower( lcTag );
m_tags.insert( lcTag );
} }
virtual void acceptChar( char c ) { virtual void acceptChar( char c ) {
m_remainder += c; m_remainder += c;
@ -1552,9 +1564,7 @@ namespace Catch {
typedef std::map<std::string, Tag> TagMap; typedef std::map<std::string, Tag> TagMap;
public: public:
void add( const Tag& tag ) { void add( const Tag& tag ) {
std::string tagName = tag.getName(); m_tags.insert( std::make_pair( toLower( tag.getName() ), tag ) );
toLower( tagName );
m_tags.insert( std::make_pair( tagName, tag ) );
} }
bool empty() const { bool empty() const {
@ -1652,12 +1662,10 @@ namespace Catch {
public: public:
TestCaseFilter( const std::string& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour ) TestCaseFilter( const std::string& testSpec, IfFilterMatches::DoWhat matchBehaviour = IfFilterMatches::AutoDetectBehaviour )
: m_stringToMatch( testSpec ), : m_stringToMatch( toLower( testSpec ) ),
m_filterType( matchBehaviour ), m_filterType( matchBehaviour ),
m_wildcardPosition( NoWildcard ) m_wildcardPosition( NoWildcard )
{ {
toLower( m_stringToMatch );
if( m_filterType == IfFilterMatches::AutoDetectBehaviour ) { if( m_filterType == IfFilterMatches::AutoDetectBehaviour ) {
if( startsWith( m_stringToMatch, "exclude:" ) ) { if( startsWith( m_stringToMatch, "exclude:" ) ) {
m_stringToMatch = m_stringToMatch.substr( 8 ); m_stringToMatch = m_stringToMatch.substr( 8 );
@ -1698,7 +1706,7 @@ namespace Catch {
bool isMatch( const TestCase& testCase ) const { bool isMatch( const TestCase& testCase ) const {
std::string name = testCase.getTestCaseInfo().name; std::string name = testCase.getTestCaseInfo().name;
toLower( name ); toLowerInPlace( name );
switch( m_wildcardPosition ) { switch( m_wildcardPosition ) {
case NoWildcard: case NoWildcard:
@ -4172,9 +4180,9 @@ namespace Catch {
if( matchesFilters( config.filters, *it ) ) { if( matchesFilters( config.filters, *it ) ) {
matchedTests++; matchedTests++;
// !TBD: consider listAs() // !TBD: consider listAs()
std::cout << "\t" << it->getTestCaseInfo().name << "\n"; std::cout << " " << it->getTestCaseInfo().name << "\n";
if( ( config.listSpec & List::TestNames ) != List::TestNames ) if( ( config.listSpec & List::TestNames ) != List::TestNames )
std::cout << "\t\t '" << it->getTestCaseInfo().description << "'\n"; std::cout << " '" << it->getTestCaseInfo().description << "'\n";
} }
} }
if( config.filters.empty() ) if( config.filters.empty() )
@ -4392,6 +4400,9 @@ namespace Catch {
} }
private: private:
RunningTest( RunningTest const& );
void operator=( RunningTest const& );
const TestCase& m_info; const TestCase& m_info;
RunStatus m_runStatus; RunStatus m_runStatus;
RunningSection m_rootSection; RunningSection m_rootSection;
@ -4729,6 +4740,9 @@ namespace Catch {
const unsigned int minorVersion; const unsigned int minorVersion;
const unsigned int buildNumber; const unsigned int buildNumber;
const std::string branchName; const std::string branchName;
private:
void operator=( Version const& );
}; };
extern Version libraryVersion; extern Version libraryVersion;
@ -5778,7 +5792,9 @@ namespace Catch {
else if( m_exprComponents.op == "matches" ) else if( m_exprComponents.op == "matches" )
return m_exprComponents.lhs + " " + m_exprComponents.rhs; return m_exprComponents.lhs + " " + m_exprComponents.rhs;
else if( m_exprComponents.op != "!" ) { else if( m_exprComponents.op != "!" ) {
if( m_exprComponents.lhs.size() + m_exprComponents.rhs.size() < 40 ) if( m_exprComponents.lhs.size() + m_exprComponents.rhs.size() < 40 &&
m_exprComponents.lhs.find("\n") == std::string::npos &&
m_exprComponents.rhs.find("\n") == std::string::npos )
return m_exprComponents.lhs + " " + m_exprComponents.op + " " + m_exprComponents.rhs; return m_exprComponents.lhs + " " + m_exprComponents.op + " " + m_exprComponents.rhs;
else else
return m_exprComponents.lhs + "\n" + m_exprComponents.op + "\n" + m_exprComponents.rhs; return m_exprComponents.lhs + "\n" + m_exprComponents.op + "\n" + m_exprComponents.rhs;
@ -5856,7 +5872,7 @@ namespace Catch {
} }
bool TestCase::hasTag( const std::string& tag ) const { bool TestCase::hasTag( const std::string& tag ) const {
return tags.find( tag ) != tags.end(); return tags.find( toLower( tag ) ) != tags.end();
} }
bool TestCase::matchesTags( const std::string& tagPattern ) const { bool TestCase::matchesTags( const std::string& tagPattern ) const {
TagExpression exp; TagExpression exp;
@ -5903,7 +5919,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 0, 9, 27, "integration" ); Version libraryVersion( 0, 9, 28, "integration" );
} }
// #included from: catch_line_wrap.hpp // #included from: catch_line_wrap.hpp
@ -5924,8 +5940,14 @@ namespace Catch {
for( std::size_t pos = 0; pos < paragraph.size(); ++pos ) { for( std::size_t pos = 0; pos < paragraph.size(); ++pos ) {
if( pos == width ) { if( pos == width ) {
addIndent( os, indent ); addIndent( os, indent );
os << paragraph.substr( 0, wrapPoint ) << "\n"; if( paragraph[wrapPoint] == ' ' ) {
return recursivelyWrapLine( os, paragraph.substr( wrapPoint+1 ), columns, indent+tab ); os << paragraph.substr( 0, wrapPoint ) << "\n";
while( paragraph[++wrapPoint] == ' ' );
}
else {
os << paragraph.substr( 0, --wrapPoint ) << "-\n";
}
return recursivelyWrapLine( os, paragraph.substr( wrapPoint ), columns, indent+tab );
} }
if( paragraph[pos] == '\t' ) { if( paragraph[pos] == '\t' ) {
tab = pos; tab = pos;
@ -7071,6 +7093,7 @@ namespace Catch {
private: private:
class AssertionPrinter { class AssertionPrinter {
void operator= ( AssertionPrinter const& );
public: public:
AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats ) AssertionPrinter( std::ostream& _stream, AssertionStats const& _stats )
: stream( _stream ), : stream( _stream ),