- includes command line tweaks and fixes for durations
This commit is contained in:
Phil Nash 2013-08-16 19:01:32 +01:00
parent 1870ca8455
commit 46118714b1
4 changed files with 49 additions and 43 deletions

View File

@ -1,6 +1,6 @@
![catch logo](catch-logo-small.png) ![catch logo](catch-logo-small.png)
*v1.0 build 7 (master branch)* *v1.0 build 8 (master branch)*
# New release with significant changes # New release with significant changes

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( 1, 0, 7, "master" ); Version libraryVersion( 1, 0, 8, "master" );
} }
#endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED #endif // TWOBLUECUBES_CATCH_VERSION_HPP_INCLUDED

View File

@ -1,6 +1,6 @@
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CatchSelfTest is a Catch v1.0 b7 host application. CatchSelfTest is a Catch v1.0 b8 host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -712,7 +712,7 @@ with expansion:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CatchSelfTest is a Catch v1.0 b7 host application. CatchSelfTest is a Catch v1.0 b8 host application.
Run with -? for options Run with -? for options
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
@ -5067,8 +5067,9 @@ TestMain.cpp:
PASSED: PASSED:
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) ) REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "greater than zero" ) )
with expansion: with expansion:
"Value after -x or --abortAfter must be greater than zero while parsing: (-x, "Value after -x or --abortAfter must be greater than zero
--abortx <number of failures>)" contains: "greater than zero" - while parsing: (-x, --abortx <number of failures>)" contains: "greater than
zero"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Process can be configured on command line Process can be configured on command line
@ -5082,8 +5083,8 @@ TestMain.cpp:
PASSED: PASSED:
REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) ) REQUIRE_THAT( parseIntoConfigAndReturnError( argv, config ) Contains( "-x" ) )
with expansion: with expansion:
"Unable to convert oops to destination type while parsing: (-x, --abortx "Unable to convert oops to destination type
<number of failures>)" contains: "-x" - while parsing: (-x, --abortx <number of failures>)" contains: "-x"
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
Process can be configured on command line Process can be configured on command line
@ -11903,7 +11904,8 @@ An error
parseIntoConfigAndReturnError( argv, config ) Contains( &quot;greater than zero&quot; ) parseIntoConfigAndReturnError( argv, config ) Contains( &quot;greater than zero&quot; )
</Original> </Original>
<Expanded> <Expanded>
&quot;Value after -x or --abortAfter must be greater than zero while parsing: (-x, --abortx &lt;number of failures>)&quot; contains: &quot;greater than zero&quot; &quot;Value after -x or --abortAfter must be greater than zero
- while parsing: (-x, --abortx &lt;number of failures>)&quot; contains: &quot;greater than zero&quot;
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="1" failures="0"/> <OverallResults successes="1" failures="0"/>
@ -11917,7 +11919,8 @@ An error
parseIntoConfigAndReturnError( argv, config ) Contains( &quot;-x&quot; ) parseIntoConfigAndReturnError( argv, config ) Contains( &quot;-x&quot; )
</Original> </Original>
<Expanded> <Expanded>
&quot;Unable to convert oops to destination type while parsing: (-x, --abortx &lt;number of failures>)&quot; contains: &quot;-x&quot; &quot;Unable to convert oops to destination type
- while parsing: (-x, --abortx &lt;number of failures>)&quot; contains: &quot;-x&quot;
</Expanded> </Expanded>
</Expression> </Expression>
<OverallResults successes="1" failures="0"/> <OverallResults successes="1" failures="0"/>

View File

@ -1,6 +1,6 @@
/* /*
* CATCH v1.0 build 7 (master branch) * CATCH v1.0 build 8 (master branch)
* Generated: 2013-08-16 08:00:49.964403 * Generated: 2013-08-16 18:58:15.279754
* ---------------------------------------------------------- * ----------------------------------------------------------
* 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.
@ -3835,12 +3835,12 @@ namespace Clara {
inline void convertInto( std::string const& _source, bool& _dest ) { inline void convertInto( std::string const& _source, bool& _dest ) {
std::string sourceLC = _source; std::string sourceLC = _source;
std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), ::tolower ); std::transform( sourceLC.begin(), sourceLC.end(), sourceLC.begin(), ::tolower );
if( sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" ) if( sourceLC == "y" || sourceLC == "1" || sourceLC == "true" || sourceLC == "yes" || sourceLC == "on" )
_dest = true; _dest = true;
else if( sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" ) else if( sourceLC == "n" || sourceLC == "0" || sourceLC == "false" || sourceLC == "no" || sourceLC == "off" )
_dest = false; _dest = false;
else else
throw std::runtime_error( "Expected a boolean value but did recognise: '" + _source + "'" ); throw std::runtime_error( "Expected a boolean value but did not recognise:\n '" + _source + "'" );
} }
inline void convertInto( bool _source, bool& _dest ) { inline void convertInto( bool _source, bool& _dest ) {
_dest = _source; _dest = _source;
@ -4057,7 +4057,7 @@ namespace Clara {
return _longName == longName; return _longName == longName;
} }
bool takesArg() const { bool takesArg() const {
return !argName.empty(); return !hint.empty();
} }
bool isFixedPositional() const { bool isFixedPositional() const {
return position != -1; return position != -1;
@ -4092,8 +4092,8 @@ namespace Clara {
oss << ", "; oss << ", ";
oss << "--" << longName; oss << "--" << longName;
} }
if( !argName.empty() ) if( !hint.empty() )
oss << " <" << argName << ">"; oss << " <" << hint << ">";
return oss.str(); return oss.str();
} }
@ -4101,7 +4101,7 @@ namespace Clara {
std::vector<std::string> shortNames; std::vector<std::string> shortNames;
std::string longName; std::string longName;
std::string description; std::string description;
std::string argName; std::string hint;
int position; int position;
}; };
@ -4147,8 +4147,8 @@ namespace Clara {
m_arg.description = description; m_arg.description = description;
return *this; return *this;
} }
ArgBinder& argName( std::string const& argName ) { ArgBinder& hint( std::string const& hint ) {
m_arg.argName = argName; m_arg.hint = hint;
return *this; return *this;
} }
ArgBinder& position( int position ) { ArgBinder& position( int position ) {
@ -4223,9 +4223,9 @@ namespace Clara {
os << " "; os << " ";
typename std::map<int, Arg>::const_iterator it = m_positionalArgs.find( i ); typename std::map<int, Arg>::const_iterator it = m_positionalArgs.find( i );
if( it != m_positionalArgs.end() ) if( it != m_positionalArgs.end() )
os << "<" << it->second.argName << ">"; os << "<" << it->second.hint << ">";
else if( m_arg.get() ) else if( m_arg.get() )
os << "<" << m_arg->argName << ">"; os << "<" << m_arg->hint << ">";
else else
throw std::logic_error( "non consecutive positional arguments with no floating args" ); throw std::logic_error( "non consecutive positional arguments with no floating args" );
} }
@ -4233,7 +4233,7 @@ namespace Clara {
if( m_arg.get() ) { if( m_arg.get() ) {
if( m_highestSpecifiedArgPosition > 1 ) if( m_highestSpecifiedArgPosition > 1 )
os << " "; os << " ";
os << "[<" << m_arg->argName << "> ...]"; os << "[<" << m_arg->hint << "> ...]";
} }
} }
std::string argSynopsis() const { std::string argSynopsis() const {
@ -4302,7 +4302,7 @@ namespace Clara {
} }
} }
catch( std::exception& ex ) { catch( std::exception& ex ) {
throw std::runtime_error( std::string( ex.what() ) + " while parsing: (" + arg.commands() + ")" ); throw std::runtime_error( std::string( ex.what() ) + "\n- while parsing: (" + arg.commands() + ")" );
} }
} }
if( it == itEnd ) if( it == itEnd )
@ -4421,20 +4421,20 @@ namespace Catch {
.describe( "output filename" ) .describe( "output filename" )
.shortOpt( "o") .shortOpt( "o")
.longOpt( "out" ) .longOpt( "out" )
.argName( "filename" ); .hint( "filename" );
cli.bind( &ConfigData::reporterName ) cli.bind( &ConfigData::reporterName )
.describe( "reporter to use - defaults to console" ) .describe( "reporter to use - defaults to console" )
.shortOpt( "r") .shortOpt( "r")
.longOpt( "reporter" ) .longOpt( "reporter" )
// .argName( "name[:filename]" ); // .hint( "name[:filename]" );
.argName( "name" ); .hint( "name" );
cli.bind( &ConfigData::name ) cli.bind( &ConfigData::name )
.describe( "suite name" ) .describe( "suite name" )
.shortOpt( "n") .shortOpt( "n")
.longOpt( "name" ) .longOpt( "name" )
.argName( "name" ); .hint( "name" );
cli.bind( &abortAfterFirst ) cli.bind( &abortAfterFirst )
.describe( "abort at first failure" ) .describe( "abort at first failure" )
@ -4445,29 +4445,29 @@ namespace Catch {
.describe( "abort after x failures" ) .describe( "abort after x failures" )
.shortOpt( "x") .shortOpt( "x")
.longOpt( "abortx" ) .longOpt( "abortx" )
.argName( "number of failures" ); .hint( "number of failures" );
cli.bind( &addWarning ) cli.bind( &addWarning )
.describe( "enable warnings" ) .describe( "enable warnings" )
.shortOpt( "w") .shortOpt( "w")
.longOpt( "warn" ) .longOpt( "warn" )
.argName( "warning name" ); .hint( "warning name" );
// cli.bind( &setVerbosity ) // cli.bind( &setVerbosity )
// .describe( "level of verbosity (0=no output)" ) // .describe( "level of verbosity (0=no output)" )
// .shortOpt( "v") // .shortOpt( "v")
// .longOpt( "verbosity" ) // .longOpt( "verbosity" )
// .argName( "level" ); // .hint( "level" );
cli.bind( &addTestOrTags ) cli.bind( &addTestOrTags )
.describe( "which test or tests to use" ) .describe( "which test or tests to use" )
.argName( "test name, pattern or tags" ); .hint( "test name, pattern or tags" );
cli.bind( &setShowDurations ) cli.bind( &setShowDurations )
.describe( "show test durations" ) .describe( "show test durations" )
.shortOpt( "d") .shortOpt( "d")
.longOpt( "durations" ) .longOpt( "durations" )
.argName( "durations" ); .hint( "yes/no" );
return cli; return cli;
} }
@ -5336,11 +5336,12 @@ namespace Catch {
m_config.reset(); m_config.reset();
} }
catch( std::exception& ex ) { catch( std::exception& ex ) {
std::cerr << "\nError in input:\n" {
<< Text( ex.what(), TextAttributes() Colour colourGuard( Colour::Red );
.setInitialIndent(2) std::cerr << "\nError in input:\n"
.setIndent(4) ) << Text( ex.what(), TextAttributes().setIndent(2) )
<< "\n\n"; << "\n\n";
}
m_cli.usage( std::cout, m_configData.processName ); m_cli.usage( std::cout, m_configData.processName );
return (std::numeric_limits<int>::max)(); return (std::numeric_limits<int>::max)();
} }
@ -6348,7 +6349,7 @@ namespace Catch {
namespace Catch { namespace Catch {
// These numbers are maintained by a script // These numbers are maintained by a script
Version libraryVersion( 1, 0, 7, "master" ); Version libraryVersion( 1, 0, 8, "master" );
} }
// #included from: catch_text.hpp // #included from: catch_text.hpp
@ -7294,9 +7295,11 @@ namespace Catch {
stream << "\nNo assertions in test case"; stream << "\nNo assertions in test case";
stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl;
} }
m_headerPrinted = false; if( m_headerPrinted ) {
if( m_config->showDurations() == ShowDurations::Always ) if( m_config->showDurations() == ShowDurations::Always )
stream << "Completed in " << _sectionStats.durationInSeconds << "s" << std::endl; stream << "Completed in " << _sectionStats.durationInSeconds << "s" << std::endl;
m_headerPrinted = false;
}
StreamingReporterBase::sectionEnded( _sectionStats ); StreamingReporterBase::sectionEnded( _sectionStats );
} }