mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-29 16:53:30 +01:00
dev build 11
This commit is contained in:
parent
34fa25ed2f
commit
8b1b7cd66e
@ -1,6 +1,6 @@
|
|||||||
![catch logo](catch-logo-small.png)
|
![catch logo](catch-logo-small.png)
|
||||||
|
|
||||||
*v1.2.1-develop.10*
|
*v1.2.1-develop.11*
|
||||||
|
|
||||||
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)
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 2, 1, "develop", 10 );
|
Version libraryVersion( 1, 2, 1, "develop", 11 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* Catch v1.2.1-develop.10
|
* Catch v1.2.1-develop.11
|
||||||
* Generated: 2015-07-24 08:13:33.830879
|
* Generated: 2015-08-03 07:40:22.369337
|
||||||
* ----------------------------------------------------------
|
* ----------------------------------------------------------
|
||||||
* 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.
|
||||||
@ -131,10 +131,13 @@
|
|||||||
// GCC
|
// GCC
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
|
|
||||||
#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__) )
|
#if __GNUC__ == 4 && __GNUC_MINOR__ >= 6 && defined(__GXX_EXPERIMENTAL_CXX0X__)
|
||||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// - otherwise more recent versions define __cplusplus >= 201103L
|
||||||
|
// and will get picked up below
|
||||||
|
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
@ -451,8 +454,7 @@ namespace Catch {
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
void swap( Ptr& other ) { std::swap( m_p, other.m_p ); }
|
void swap( Ptr& other ) { std::swap( m_p, other.m_p ); }
|
||||||
T* get() { return m_p; }
|
T* get() const{ return m_p; }
|
||||||
const T* get() const{ return m_p; }
|
|
||||||
T& operator*() const { return *m_p; }
|
T& operator*() const { return *m_p; }
|
||||||
T* operator->() const { return m_p; }
|
T* operator->() const { return m_p; }
|
||||||
bool operator !() const { return m_p == CATCH_NULL; }
|
bool operator !() const { return m_p == CATCH_NULL; }
|
||||||
@ -5645,89 +5647,76 @@ namespace Catch {
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
class Runner {
|
Ptr<IStreamingReporter> makeReporter( Ptr<Config> const& config ) {
|
||||||
|
std::string reporterName = config->getReporterName().empty()
|
||||||
|
? "console"
|
||||||
|
: config->getReporterName();
|
||||||
|
|
||||||
public:
|
Ptr<IStreamingReporter> reporter = getRegistryHub().getReporterRegistry().create( reporterName, config.get() );
|
||||||
Runner( Ptr<Config> const& config )
|
if( !reporter ) {
|
||||||
: m_config( config )
|
std::ostringstream oss;
|
||||||
{
|
oss << "No reporter registered with name: '" << reporterName << "'";
|
||||||
openStream();
|
throw std::domain_error( oss.str() );
|
||||||
makeReporter();
|
|
||||||
}
|
}
|
||||||
|
return reporter;
|
||||||
|
}
|
||||||
|
|
||||||
Totals runTests() {
|
void openStreamInto( Ptr<Config> const& config, std::ofstream& ofs ) {
|
||||||
|
// Open output file, if specified
|
||||||
RunContext context( m_config.get(), m_reporter );
|
if( !config->getFilename().empty() ) {
|
||||||
|
ofs.open( config->getFilename().c_str() );
|
||||||
Totals totals;
|
if( ofs.fail() ) {
|
||||||
|
|
||||||
context.testGroupStarting( "all tests", 1, 1 ); // deprecated?
|
|
||||||
|
|
||||||
TestSpec testSpec = m_config->testSpec();
|
|
||||||
if( !testSpec.hasFilters() )
|
|
||||||
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests
|
|
||||||
|
|
||||||
std::vector<TestCase> testCases;
|
|
||||||
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *m_config, testCases );
|
|
||||||
|
|
||||||
int testsRunForGroup = 0;
|
|
||||||
for( std::vector<TestCase>::const_iterator it = testCases.begin(), itEnd = testCases.end();
|
|
||||||
it != itEnd;
|
|
||||||
++it ) {
|
|
||||||
testsRunForGroup++;
|
|
||||||
if( m_testsAlreadyRun.find( *it ) == m_testsAlreadyRun.end() ) {
|
|
||||||
|
|
||||||
if( context.aborting() )
|
|
||||||
break;
|
|
||||||
|
|
||||||
totals += context.runTest( *it );
|
|
||||||
m_testsAlreadyRun.insert( *it );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
std::vector<TestCase> skippedTestCases;
|
|
||||||
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *m_config, skippedTestCases, true );
|
|
||||||
|
|
||||||
for( std::vector<TestCase>::const_iterator it = skippedTestCases.begin(), itEnd = skippedTestCases.end();
|
|
||||||
it != itEnd;
|
|
||||||
++it )
|
|
||||||
m_reporter->skipTest( *it );
|
|
||||||
|
|
||||||
context.testGroupEnded( "all tests", totals, 1, 1 );
|
|
||||||
return totals;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void openStream() {
|
|
||||||
// Open output file, if specified
|
|
||||||
if( !m_config->getFilename().empty() ) {
|
|
||||||
m_ofs.open( m_config->getFilename().c_str() );
|
|
||||||
if( m_ofs.fail() ) {
|
|
||||||
std::ostringstream oss;
|
|
||||||
oss << "Unable to open file: '" << m_config->getFilename() << "'";
|
|
||||||
throw std::domain_error( oss.str() );
|
|
||||||
}
|
|
||||||
m_config->setStreamBuf( m_ofs.rdbuf() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
void makeReporter() {
|
|
||||||
std::string reporterName = m_config->getReporterName().empty()
|
|
||||||
? "console"
|
|
||||||
: m_config->getReporterName();
|
|
||||||
|
|
||||||
m_reporter = getRegistryHub().getReporterRegistry().create( reporterName, m_config.get() );
|
|
||||||
if( !m_reporter ) {
|
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "No reporter registered with name: '" << reporterName << "'";
|
oss << "Unable to open file: '" << config->getFilename() << "'";
|
||||||
throw std::domain_error( oss.str() );
|
throw std::domain_error( oss.str() );
|
||||||
}
|
}
|
||||||
|
config->setStreamBuf( ofs.rdbuf() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
Totals runTests( Ptr<Config> const& config ) {
|
||||||
Ptr<Config> m_config;
|
|
||||||
std::ofstream m_ofs;
|
std::ofstream ofs;
|
||||||
Ptr<IStreamingReporter> m_reporter;
|
openStreamInto( config, ofs );
|
||||||
std::set<TestCase> m_testsAlreadyRun;
|
Ptr<IStreamingReporter> reporter = makeReporter( config );
|
||||||
};
|
|
||||||
|
RunContext context( config.get(), reporter );
|
||||||
|
|
||||||
|
Totals totals;
|
||||||
|
|
||||||
|
context.testGroupStarting( config->name(), 1, 1 );
|
||||||
|
|
||||||
|
TestSpec testSpec = config->testSpec();
|
||||||
|
if( !testSpec.hasFilters() )
|
||||||
|
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "~[.]" ).testSpec(); // All not hidden tests
|
||||||
|
|
||||||
|
std::vector<TestCase> testCases;
|
||||||
|
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *config, testCases );
|
||||||
|
|
||||||
|
std::set<TestCase> testsAlreadyRun;
|
||||||
|
for( std::vector<TestCase>::const_iterator it = testCases.begin(), itEnd = testCases.end();
|
||||||
|
it != itEnd;
|
||||||
|
++it ) {
|
||||||
|
if( testsAlreadyRun.find( *it ) == testsAlreadyRun.end() ) {
|
||||||
|
|
||||||
|
if( context.aborting() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
totals += context.runTest( *it );
|
||||||
|
testsAlreadyRun.insert( *it );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
std::vector<TestCase> skippedTestCases;
|
||||||
|
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, *config, skippedTestCases, true );
|
||||||
|
|
||||||
|
for( std::vector<TestCase>::const_iterator it = skippedTestCases.begin(), itEnd = skippedTestCases.end();
|
||||||
|
it != itEnd;
|
||||||
|
++it )
|
||||||
|
reporter->skipTest( *it );
|
||||||
|
|
||||||
|
context.testGroupEnded( config->name(), totals, 1, 1 );
|
||||||
|
return totals;
|
||||||
|
}
|
||||||
|
|
||||||
void applyFilenamesAsTags() {
|
void applyFilenamesAsTags() {
|
||||||
std::vector<TestCase> const& tests = getRegistryHub().getTestCaseRegistry().getAllTests();
|
std::vector<TestCase> const& tests = getRegistryHub().getTestCaseRegistry().getAllTests();
|
||||||
@ -5824,13 +5813,11 @@ namespace Catch {
|
|||||||
|
|
||||||
seedRng( *m_config );
|
seedRng( *m_config );
|
||||||
|
|
||||||
Runner runner( m_config );
|
|
||||||
|
|
||||||
// Handle list request
|
// Handle list request
|
||||||
if( Option<std::size_t> listed = list( config() ) )
|
if( Option<std::size_t> listed = list( config() ) )
|
||||||
return static_cast<int>( *listed );
|
return static_cast<int>( *listed );
|
||||||
|
|
||||||
return static_cast<int>( runner.runTests().assertions.failed );
|
return static_cast<int>( runTests( m_config ).assertions.failed );
|
||||||
}
|
}
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
Catch::cerr() << ex.what() << std::endl;
|
Catch::cerr() << ex.what() << std::endl;
|
||||||
@ -6942,7 +6929,7 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
Version libraryVersion( 1, 2, 1, "develop", 10 );
|
Version libraryVersion( 1, 2, 1, "develop", 11 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user