mirror of
https://github.com/catchorg/Catch2.git
synced 2025-09-10 23:45:39 +02:00
Compare commits
37 Commits
v1.2.1-dev
...
v1.2.1-dev
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7e34619f03 | ||
![]() |
4636be9744 | ||
![]() |
015e07100e | ||
![]() |
bc8840cbb8 | ||
![]() |
471bd2556a | ||
![]() |
aa49823bc0 | ||
![]() |
52a417df7b | ||
![]() |
0b523db6b9 | ||
![]() |
b8515929b8 | ||
![]() |
3deb3e010f | ||
![]() |
73a140fb9e | ||
![]() |
ef62b578e2 | ||
![]() |
f4389b4fdb | ||
![]() |
4b99be6a9a | ||
![]() |
293e54dcbe | ||
![]() |
9a6a0865f2 | ||
![]() |
2c6411e70a | ||
![]() |
1cb993970a | ||
![]() |
b3b2352045 | ||
![]() |
c9a188df45 | ||
![]() |
e904aa7f6e | ||
![]() |
d43a47efca | ||
![]() |
a0de07d45b | ||
![]() |
0c1c9fa922 | ||
![]() |
166ca2e819 | ||
![]() |
d234ed1a67 | ||
![]() |
7fd7c5b8c8 | ||
![]() |
312b94e532 | ||
![]() |
40d0d2f656 | ||
![]() |
19520157fb | ||
![]() |
ad7edd0680 | ||
![]() |
8a05f46a37 | ||
![]() |
e73583d556 | ||
![]() |
afcc38efc5 | ||
![]() |
368714e7aa | ||
![]() |
4cb74761d9 | ||
![]() |
c06e1909ae |
164
.travis.yml
164
.travis.yml
@@ -1,19 +1,163 @@
|
||||
language: cpp
|
||||
sudo: false
|
||||
|
||||
compiler:
|
||||
- clang
|
||||
- gcc
|
||||
cache:
|
||||
ccache: true
|
||||
directories:
|
||||
- $HOME/.ccache
|
||||
|
||||
env:
|
||||
- BUILD_TYPE=Debug
|
||||
- BUILD_TYPE=Release
|
||||
global:
|
||||
- USE_CCACHE=1
|
||||
- CCACHE_COMPRESS=1
|
||||
- CCACHE_MAXSIZE=200M
|
||||
- CCACHE_CPP2=1
|
||||
|
||||
|
||||
matrix:
|
||||
include:
|
||||
|
||||
# 1/ Linux Clang Builds
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: &clang35
|
||||
apt:
|
||||
sources: ['llvm-toolchain-precise-3.5', 'ubuntu-toolchain-r-test']
|
||||
packages: ['clang-3.5']
|
||||
env: COMPILER='ccache clang++-3.5' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: *clang35
|
||||
env: COMPILER='ccache clang++-3.5' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: &clang36
|
||||
apt:
|
||||
sources: ['llvm-toolchain-precise-3.6', 'ubuntu-toolchain-r-test']
|
||||
packages: ['clang-3.6']
|
||||
env: COMPILER='ccache clang++-3.6' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: *clang36
|
||||
env: COMPILER='ccache clang++-3.6' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: &clang37
|
||||
apt:
|
||||
sources: ['llvm-toolchain-precise-3.7', 'ubuntu-toolchain-r-test']
|
||||
packages: ['clang-3.7']
|
||||
env: COMPILER='ccache clang++-3.7' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: *clang37
|
||||
env: COMPILER='ccache clang++-3.7' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: &clang38
|
||||
apt:
|
||||
sources: ['llvm-toolchain-precise', 'ubuntu-toolchain-r-test']
|
||||
packages: ['clang-3.8']
|
||||
env: COMPILER='ccache clang++-3.8' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: clang
|
||||
addons: *clang38
|
||||
env: COMPILER='ccache clang++-3.8' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
# 2/ Linux GCC Builds
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: &gcc48
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-4.8']
|
||||
env: COMPILER='ccache g++-4.8' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: *gcc48
|
||||
env: COMPILER='ccache g++-4.8' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: &gcc49
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-4.9']
|
||||
env: COMPILER='ccache g++-4.9' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: *gcc49
|
||||
env: COMPILER='ccache g++-4.9' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: &gcc5
|
||||
apt:
|
||||
sources: ['ubuntu-toolchain-r-test']
|
||||
packages: ['g++-5']
|
||||
env: COMPILER='ccache g++-5' BUILD_TYPE='Release'
|
||||
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
addons: *gcc5
|
||||
env: COMPILER='ccache g++-5' BUILD_TYPE='Debug'
|
||||
|
||||
|
||||
# 3/ OSX Clang Builds
|
||||
- os: osx
|
||||
osx_image: xcode6.4
|
||||
compiler: clang
|
||||
env: COMPILER='ccache clang++' BUILD_TYPE='Debug'
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode6.4
|
||||
compiler: clang
|
||||
env: COMPILER='ccache clang++' BUILD_TYPE='Release'
|
||||
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode7
|
||||
compiler: clang
|
||||
env: COMPILER='ccache clang++' BUILD_TYPE='Debug'
|
||||
|
||||
- os: osx
|
||||
osx_image: xcode7
|
||||
compiler: clang
|
||||
env: COMPILER='ccache clang++' BUILD_TYPE='Release'
|
||||
|
||||
|
||||
install:
|
||||
- cmake -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
- DEPS_DIR="${TRAVIS_BUILD_DIR}/deps"
|
||||
- mkdir -p ${DEPS_DIR} && cd ${DEPS_DIR}
|
||||
- |
|
||||
if [[ "${TRAVIS_OS_NAME}" == "linux" ]]; then
|
||||
CMAKE_URL="http://www.cmake.org/files/v3.3/cmake-3.3.2-Linux-x86_64.tar.gz"
|
||||
mkdir cmake && travis_retry wget --quiet -O - ${CMAKE_URL} | tar --strip-components=1 -xz -C cmake
|
||||
export PATH=${DEPS_DIR}/cmake/bin:${PATH}
|
||||
elif [[ "${TRAVIS_OS_NAME}" == "osx" ]]; then
|
||||
brew install cmake ccache
|
||||
fi
|
||||
|
||||
before_script:
|
||||
- export CXX=${COMPILER}
|
||||
- cd ${TRAVIS_BUILD_DIR}
|
||||
- cmake -Hprojects/CMake -BBuild -DCMAKE_BUILD_TYPE=${BUILD_TYPE}
|
||||
- cd Build
|
||||
- make
|
||||
- cd ..
|
||||
|
||||
script:
|
||||
- cd Build
|
||||
- ctest -V
|
||||
- make -j 2
|
||||
- ctest -V -j 2
|
||||
|
@@ -1,6 +1,6 @@
|
||||

|
||||
|
||||
*v1.2.1-develop.11*
|
||||
*v1.2.1-develop.15*
|
||||
|
||||
Build status (on Travis CI) [](https://travis-ci.org/philsquared/Catch)
|
||||
|
||||
|
@@ -58,6 +58,9 @@ This can be useful on certain platforms that do not provide ```std::cout``` and
|
||||
CATCH_CONFIG_CPP11_IS_ENUM // std::is_enum is supported?
|
||||
CATCH_CONFIG_CPP11_TUPLE // std::tuple is supported
|
||||
CATCH_CONFIG_VARIADIC_MACROS // Usually pre-C++11 compiler extensions are sufficient
|
||||
CATCH_CONFIG_CPP11_LONG_LONG // generates overloads for the long long type
|
||||
CATCH_CONFIG_CPP11_OVERRIDE // CATCH_OVERRIDE expands to override (for virtual function implementations)
|
||||
CATCH_CONFIG_CPP11_UNIQUE_PTR // Use std::unique_ptr instead of std::auto_ptr
|
||||
|
||||
Catch has some basic compiler detection that will attempt to select the appropriate mix of these macros. However being incomplete - and often without access to the respective compilers - this detection tends to be conservative.
|
||||
So overriding control is given to the user. If a compiler supports a feature (and Catch does not already detect it) then one or more of these may be defined to enable it (or suppress it, in some cases). If you do do this please raise an issue, specifying your compiler version (ideally with an idea of how to detect it) and stating that it has such support.
|
||||
|
@@ -96,7 +96,7 @@ Although this was a simple test it's been enough to demonstrate a few things abo
|
||||
|
||||
Most test frameworks have a class-based fixture mechanism. That is, test cases map to methods on a class and common setup and teardown can be performed in ```setup()``` and ```teardown()``` methods (or constructor/ destructor in languages, like C++, that support deterministic destruction).
|
||||
|
||||
While Catch fully supports this way of working there are a few problems with the approach. In particular, the way your code must be split up and the blunt granularity of cause problems. You can only have one setup/ teardown pair across a set of methods, but sometimes you want slightly different setup in each method, or you may even want several levels of setup (a concept which we will clarify later on in this tutorial). It was <a href="http://jamesnewkirk.typepad.com/posts/2007/09/why-you-should-.html">problems like these</a> that led James Newkirk, who led the team that built NUnit, to start again from scratch and <a href="http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html">build xUnit</a>).
|
||||
While Catch fully supports this way of working there are a few problems with the approach. In particular the way your code must be split up, and the blunt granularity of it, may cause problems. You can only have one setup/ teardown pair across a set of methods, but sometimes you want slightly different setup in each method, or you may even want several levels of setup (a concept which we will clarify later on in this tutorial). It was <a href="http://jamesnewkirk.typepad.com/posts/2007/09/why-you-should-.html">problems like these</a> that led James Newkirk, who led the team that built NUnit, to start again from scratch and <a href="http://jamesnewkirk.typepad.com/posts/2007/09/announcing-xuni.html">build xUnit</a>).
|
||||
|
||||
Catch takes a different approach (to both NUnit and xUnit) that is a more natural fit for C++ and the C family of languages. This is best explained through an example:
|
||||
|
||||
|
@@ -10,7 +10,7 @@
|
||||
|
||||
#include "internal/catch_commandline.hpp"
|
||||
#include "internal/catch_list.hpp"
|
||||
#include "internal/catch_runner_impl.hpp"
|
||||
#include "internal/catch_run_context.hpp"
|
||||
#include "internal/catch_test_spec.hpp"
|
||||
#include "internal/catch_version.h"
|
||||
#include "internal/catch_text.h"
|
||||
@@ -21,11 +21,7 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
Ptr<IStreamingReporter> makeReporter( Ptr<Config> const& config ) {
|
||||
std::string reporterName = config->getReporterName().empty()
|
||||
? "console"
|
||||
: config->getReporterName();
|
||||
|
||||
Ptr<IStreamingReporter> createReporter( std::string const& reporterName, Ptr<Config> const& config ) {
|
||||
Ptr<IStreamingReporter> reporter = getRegistryHub().getReporterRegistry().create( reporterName, config.get() );
|
||||
if( !reporter ) {
|
||||
std::ostringstream oss;
|
||||
@@ -35,26 +31,36 @@ namespace Catch {
|
||||
return reporter;
|
||||
}
|
||||
|
||||
void openStreamInto( Ptr<Config> const& config, std::ofstream& ofs ) {
|
||||
// Open output file, if specified
|
||||
if( !config->getFilename().empty() ) {
|
||||
ofs.open( config->getFilename().c_str() );
|
||||
if( ofs.fail() ) {
|
||||
std::ostringstream oss;
|
||||
oss << "Unable to open file: '" << config->getFilename() << "'";
|
||||
throw std::domain_error( oss.str() );
|
||||
}
|
||||
config->setStreamBuf( ofs.rdbuf() );
|
||||
}
|
||||
Ptr<IStreamingReporter> makeReporter( Ptr<Config> const& config ) {
|
||||
std::vector<std::string> reporters = config->getReporterNames();
|
||||
if( reporters.empty() )
|
||||
reporters.push_back( "console" );
|
||||
|
||||
Ptr<IStreamingReporter> reporter;
|
||||
for( std::vector<std::string>::const_iterator it = reporters.begin(), itEnd = reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
reporter = addReporter( reporter, createReporter( *it, config ) );
|
||||
return reporter;
|
||||
}
|
||||
Ptr<IStreamingReporter> addListeners( Ptr<IConfig const> const& config, Ptr<IStreamingReporter> reporters ) {
|
||||
IReporterRegistry::Listeners listeners = getRegistryHub().getReporterRegistry().getListeners();
|
||||
for( IReporterRegistry::Listeners::const_iterator it = listeners.begin(), itEnd = listeners.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
reporters = addReporter(reporters, (*it)->create( ReporterConfig( config ) ) );
|
||||
return reporters;
|
||||
}
|
||||
|
||||
|
||||
Totals runTests( Ptr<Config> const& config ) {
|
||||
|
||||
std::ofstream ofs;
|
||||
openStreamInto( config, ofs );
|
||||
Ptr<IConfig const> iconfig = config.get();
|
||||
|
||||
Ptr<IStreamingReporter> reporter = makeReporter( config );
|
||||
|
||||
RunContext context( config.get(), reporter );
|
||||
reporter = addListeners( iconfig, reporter );
|
||||
|
||||
RunContext context( iconfig, reporter );
|
||||
|
||||
Totals totals;
|
||||
|
||||
@@ -64,36 +70,22 @@ namespace Catch {
|
||||
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();
|
||||
std::vector<TestCase> const& allTestCases = getAllTestCasesSorted( *iconfig );
|
||||
for( std::vector<TestCase>::const_iterator it = allTestCases.begin(), itEnd = allTestCases.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
if( testsAlreadyRun.find( *it ) == testsAlreadyRun.end() ) {
|
||||
|
||||
if( context.aborting() )
|
||||
break;
|
||||
|
||||
if( !context.aborting() && matchTest( *it, testSpec, *iconfig ) )
|
||||
totals += context.runTest( *it );
|
||||
testsAlreadyRun.insert( *it );
|
||||
}
|
||||
else
|
||||
reporter->skipTest( *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 );
|
||||
context.testGroupEnded( iconfig->name(), totals, 1, 1 );
|
||||
return totals;
|
||||
}
|
||||
|
||||
void applyFilenamesAsTags() {
|
||||
std::vector<TestCase> const& tests = getRegistryHub().getTestCaseRegistry().getAllTests();
|
||||
void applyFilenamesAsTags( IConfig const& config ) {
|
||||
std::vector<TestCase> const& tests = getAllTestCasesSorted( config );
|
||||
for(std::size_t i = 0; i < tests.size(); ++i ) {
|
||||
TestCase& test = const_cast<TestCase&>( tests[i] );
|
||||
std::set<std::string> tags = test.tags;
|
||||
@@ -181,12 +173,12 @@ namespace Catch {
|
||||
try
|
||||
{
|
||||
config(); // Force config to be constructed
|
||||
|
||||
if( m_configData.filenamesAsTags )
|
||||
applyFilenamesAsTags();
|
||||
|
||||
seedRng( *m_config );
|
||||
|
||||
if( m_configData.filenamesAsTags )
|
||||
applyFilenamesAsTags( *m_config );
|
||||
|
||||
// Handle list request
|
||||
if( Option<std::size_t> listed = list( config() ) )
|
||||
return static_cast<int>( *listed );
|
||||
@@ -213,7 +205,6 @@ namespace Catch {
|
||||
m_config = new Config( m_configData );
|
||||
return *m_config;
|
||||
}
|
||||
|
||||
private:
|
||||
Clara::CommandLine<ConfigData> m_cli;
|
||||
std::vector<Clara::Parser::Token> m_unusedTokens;
|
7
include/external/clara.h
vendored
7
include/external/clara.h
vendored
@@ -503,12 +503,7 @@ namespace Clara {
|
||||
}
|
||||
};
|
||||
|
||||
// NOTE: std::auto_ptr is deprecated in c++11/c++0x
|
||||
#if defined(__cplusplus) && __cplusplus > 199711L
|
||||
typedef std::unique_ptr<Arg> ArgAutoPtr;
|
||||
#else
|
||||
typedef std::auto_ptr<Arg> ArgAutoPtr;
|
||||
#endif
|
||||
typedef CATCH_AUTO_PTR( Arg ) ArgAutoPtr;
|
||||
|
||||
friend void addOptName( Arg& arg, std::string const& optName )
|
||||
{
|
||||
|
@@ -23,6 +23,7 @@ namespace Catch {
|
||||
config.abortAfter = x;
|
||||
}
|
||||
inline void addTestOrTags( ConfigData& config, std::string const& _testSpec ) { config.testsOrTags.push_back( _testSpec ); }
|
||||
inline void addReporterName( ConfigData& config, std::string const& _reporterName ) { config.reporterNames.push_back( _reporterName ); }
|
||||
|
||||
inline void addWarning( ConfigData& config, std::string const& _warning ) {
|
||||
if( _warning == "NoAssertions" )
|
||||
@@ -116,7 +117,7 @@ namespace Catch {
|
||||
cli["-r"]["--reporter"]
|
||||
// .placeholder( "name[:filename]" )
|
||||
.describe( "reporter to use (defaults to console)" )
|
||||
.bind( &ConfigData::reporterName, "name" );
|
||||
.bind( &addReporterName, "name" );
|
||||
|
||||
cli["-n"]["--name"]
|
||||
.describe( "suite name" )
|
||||
|
@@ -17,11 +17,17 @@
|
||||
// CATCH_CONFIG_CPP11_IS_ENUM : std::is_enum is supported?
|
||||
// CATCH_CONFIG_CPP11_TUPLE : std::tuple is supported
|
||||
// CATCH_CONFIG_CPP11_LONG_LONG : is long long supported?
|
||||
// CATCH_CONFIG_CPP11_OVERRIDE : is override supported?
|
||||
// CATCH_CONFIG_CPP11_UNIQUE_PTR : is unique_ptr supported (otherwise use auto_ptr)
|
||||
|
||||
// CATCH_CONFIG_CPP11_OR_GREATER : Is C++11 supported?
|
||||
|
||||
// CATCH_CONFIG_VARIADIC_MACROS : are variadic macros supported?
|
||||
|
||||
// ****************
|
||||
// Note to maintainers: if new toggles are added please document them
|
||||
// in configuration.md, too
|
||||
// ****************
|
||||
|
||||
// In general each macro has a _NO_<feature name> form
|
||||
// (e.g. CATCH_CONFIG_CPP11_NO_NULLPTR) which disables the feature.
|
||||
@@ -83,6 +89,7 @@
|
||||
|
||||
#if (_MSC_VER >= 1600)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_NULLPTR
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
#if (_MSC_VER >= 1900 ) // (VC++ 13 (VS2015))
|
||||
@@ -92,6 +99,8 @@
|
||||
|
||||
#endif // _MSC_VER
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// Use variadic macros if the compiler supports them
|
||||
#if ( defined _MSC_VER && _MSC_VER > 1400 && !defined __EDGE__) || \
|
||||
( defined __WAVE__ && __WAVE_HAS_VARIADICS ) || \
|
||||
@@ -106,7 +115,7 @@
|
||||
// C++ language feature support
|
||||
|
||||
// catch all support for C++11
|
||||
#if (__cplusplus >= 201103L)
|
||||
#if defined(__cplusplus) && __cplusplus >= 201103L
|
||||
|
||||
# define CATCH_CPP11_OR_GREATER
|
||||
|
||||
@@ -138,6 +147,14 @@
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG
|
||||
# endif
|
||||
|
||||
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE
|
||||
# endif
|
||||
# if !defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR)
|
||||
# define CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR
|
||||
# endif
|
||||
|
||||
|
||||
#endif // __cplusplus >= 201103L
|
||||
|
||||
// Now set the actual defines based on the above + anything the user has configured
|
||||
@@ -159,9 +176,15 @@
|
||||
#if defined(CATCH_INTERNAL_CONFIG_VARIADIC_MACROS) && !defined(CATCH_CONFIG_NO_VARIADIC_MACROS) && !defined(CATCH_CONFIG_VARIADIC_MACROS)
|
||||
# define CATCH_CONFIG_VARIADIC_MACROS
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG)
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_LONG_LONG) && !defined(CATCH_CONFIG_CPP11_LONG_LONG) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_LONG_LONG
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_OVERRIDE) && !defined(CATCH_CONFIG_CPP11_OVERRIDE) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_OVERRIDE
|
||||
#endif
|
||||
#if defined(CATCH_INTERNAL_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_UNIQUE_PTR) && !defined(CATCH_CONFIG_CPP11_UNIQUE_PTR) && !defined(CATCH_CONFIG_NO_CPP11)
|
||||
# define CATCH_CONFIG_CPP11_UNIQUE_PTR
|
||||
#endif
|
||||
|
||||
|
||||
// noexcept support:
|
||||
@@ -180,5 +203,19 @@
|
||||
# define CATCH_NULL NULL
|
||||
#endif
|
||||
|
||||
// override support
|
||||
#ifdef CATCH_CONFIG_CPP11_OVERRIDE
|
||||
# define CATCH_OVERRIDE override
|
||||
#else
|
||||
# define CATCH_OVERRIDE
|
||||
#endif
|
||||
|
||||
// unique_ptr support
|
||||
#ifdef CATCH_CONFIG_CPP11_UNIQUE_PTR
|
||||
# define CATCH_AUTO_PTR( T ) std::unique_ptr<T>
|
||||
#else
|
||||
# define CATCH_AUTO_PTR( T ) std::auto_ptr<T>
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED
|
||||
|
||||
|
@@ -68,11 +68,11 @@ namespace Catch {
|
||||
ShowDurations::OrNot showDurations;
|
||||
RunTests::InWhatOrder runOrder;
|
||||
|
||||
std::string reporterName;
|
||||
std::string outputFilename;
|
||||
std::string name;
|
||||
std::string processName;
|
||||
|
||||
std::vector<std::string> reporterNames;
|
||||
std::vector<std::string> testsOrTags;
|
||||
};
|
||||
|
||||
@@ -85,12 +85,11 @@ namespace Catch {
|
||||
public:
|
||||
|
||||
Config()
|
||||
: m_os( Catch::cout().rdbuf() )
|
||||
{}
|
||||
|
||||
Config( ConfigData const& data )
|
||||
: m_data( data ),
|
||||
m_os( Catch::cout().rdbuf() )
|
||||
m_stream( openStream() )
|
||||
{
|
||||
if( !data.testsOrTags.empty() ) {
|
||||
TestSpecParser parser( ITagAliasRegistry::get() );
|
||||
@@ -101,12 +100,6 @@ namespace Catch {
|
||||
}
|
||||
|
||||
virtual ~Config() {
|
||||
m_os.rdbuf( Catch::cout().rdbuf() );
|
||||
m_stream.release();
|
||||
}
|
||||
|
||||
void setFilename( std::string const& filename ) {
|
||||
m_data.outputFilename = filename;
|
||||
}
|
||||
|
||||
std::string const& getFilename() const {
|
||||
@@ -122,18 +115,7 @@ namespace Catch {
|
||||
|
||||
bool shouldDebugBreak() const { return m_data.shouldDebugBreak; }
|
||||
|
||||
void setStreamBuf( std::streambuf* buf ) {
|
||||
m_os.rdbuf( buf ? buf : Catch::cout().rdbuf() );
|
||||
}
|
||||
|
||||
void useStream( std::string const& streamName ) {
|
||||
Stream stream = createStream( streamName );
|
||||
setStreamBuf( stream.streamBuf );
|
||||
m_stream.release();
|
||||
m_stream = stream;
|
||||
}
|
||||
|
||||
std::string getReporterName() const { return m_data.reporterName; }
|
||||
std::vector<std::string> getReporterNames() const { return m_data.reporterNames; }
|
||||
|
||||
int abortAfter() const { return m_data.abortAfter; }
|
||||
|
||||
@@ -144,7 +126,7 @@ namespace Catch {
|
||||
|
||||
// IConfig interface
|
||||
virtual bool allowThrows() const { return !m_data.noThrow; }
|
||||
virtual std::ostream& stream() const { return m_os; }
|
||||
virtual std::ostream& stream() const { return m_stream->stream(); }
|
||||
virtual std::string name() const { return m_data.name.empty() ? m_data.processName : m_data.name; }
|
||||
virtual bool includeSuccessfulResults() const { return m_data.showSuccessfulTests; }
|
||||
virtual bool warnAboutMissingAssertions() const { return m_data.warnings & WarnAbout::NoAssertions; }
|
||||
@@ -154,14 +136,25 @@ namespace Catch {
|
||||
virtual bool forceColour() const { return m_data.forceColour; }
|
||||
|
||||
private:
|
||||
|
||||
IStream const* openStream() {
|
||||
if( m_data.outputFilename.empty() )
|
||||
return new CoutStream();
|
||||
else if( m_data.outputFilename[0] == '%' ) {
|
||||
if( m_data.outputFilename == "%debug" )
|
||||
return new DebugOutStream();
|
||||
else
|
||||
throw std::domain_error( "Unrecognised stream: " + m_data.outputFilename );
|
||||
}
|
||||
else
|
||||
return new FileStream( m_data.outputFilename );
|
||||
}
|
||||
ConfigData m_data;
|
||||
|
||||
Stream m_stream;
|
||||
mutable std::ostream m_os;
|
||||
std::auto_ptr<IStream const> m_stream;
|
||||
TestSpec m_testSpec;
|
||||
};
|
||||
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_CONFIG_HPP_INCLUDED
|
||||
|
@@ -8,7 +8,7 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_CONTEXT_IMPL_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_CONTEXT_IMPL_HPP_INCLUDED
|
||||
|
||||
#include "catch_runner_impl.hpp"
|
||||
#include "catch_run_context.hpp"
|
||||
|
||||
#include "catch_context.h"
|
||||
#include "catch_stream.hpp"
|
||||
@@ -95,14 +95,6 @@ namespace Catch {
|
||||
return getCurrentMutableContext();
|
||||
}
|
||||
|
||||
Stream createStream( std::string const& streamName ) {
|
||||
if( streamName == "stdout" ) return Stream( Catch::cout().rdbuf(), false );
|
||||
if( streamName == "stderr" ) return Stream( Catch::cerr().rdbuf(), false );
|
||||
if( streamName == "debug" ) return Stream( new StreamBufImpl<OutputDebugWriter>, true );
|
||||
|
||||
throw std::domain_error( "Unknown stream: " + streamName );
|
||||
}
|
||||
|
||||
void cleanUpContext() {
|
||||
delete currentContext;
|
||||
currentContext = CATCH_NULL;
|
||||
|
@@ -16,7 +16,7 @@
|
||||
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||
#endif
|
||||
|
||||
#include "../catch_runner.hpp"
|
||||
#include "../catch_session.hpp"
|
||||
#include "catch_registry_hub.hpp"
|
||||
#include "catch_notimplemented_exception.hpp"
|
||||
#include "catch_context_impl.hpp"
|
||||
@@ -35,15 +35,20 @@
|
||||
#include "catch_tostring.hpp"
|
||||
#include "catch_result_builder.hpp"
|
||||
#include "catch_tag_alias_registry.hpp"
|
||||
#include "catch_test_case_tracker.hpp"
|
||||
|
||||
#include "../reporters/catch_reporter_multi.hpp"
|
||||
#include "../reporters/catch_reporter_xml.hpp"
|
||||
#include "../reporters/catch_reporter_junit.hpp"
|
||||
#include "../reporters/catch_reporter_console.hpp"
|
||||
#include "../reporters/catch_reporter_compact.hpp"
|
||||
|
||||
namespace Catch {
|
||||
// These are all here to avoid warnings about not having any out of line
|
||||
// virtual methods
|
||||
NonCopyable::~NonCopyable() {}
|
||||
IShared::~IShared() {}
|
||||
IStream::~IStream() CATCH_NOEXCEPT {}
|
||||
StreamBufBase::~StreamBufBase() CATCH_NOEXCEPT {}
|
||||
IContext::~IContext() {}
|
||||
IResultCapture::~IResultCapture() {}
|
||||
@@ -89,6 +94,13 @@ namespace Catch {
|
||||
Matchers::Impl::StdString::EndsWith::~EndsWith() {}
|
||||
|
||||
void Config::dummy() {}
|
||||
|
||||
namespace TestCaseTracking {
|
||||
ITracker::~ITracker() {}
|
||||
TrackerBase::~TrackerBase() {}
|
||||
SectionTracker::~SectionTracker() {}
|
||||
IndexTracker::~IndexTracker() {}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef __clang__
|
||||
|
@@ -18,6 +18,7 @@ namespace Catch {
|
||||
class AssertionResult;
|
||||
struct AssertionInfo;
|
||||
struct SectionInfo;
|
||||
struct SectionEndInfo;
|
||||
struct MessageInfo;
|
||||
class ScopedMessageBuilder;
|
||||
struct Counts;
|
||||
@@ -29,7 +30,8 @@ namespace Catch {
|
||||
virtual void assertionEnded( AssertionResult const& result ) = 0;
|
||||
virtual bool sectionStarted( SectionInfo const& sectionInfo,
|
||||
Counts& assertions ) = 0;
|
||||
virtual void sectionEnded( SectionInfo const& name, Counts const& assertions, double _durationInSeconds ) = 0;
|
||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0;
|
||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0;
|
||||
virtual void pushScopedMessage( MessageInfo const& message ) = 0;
|
||||
virtual void popScopedMessage( MessageInfo const& message ) = 0;
|
||||
|
||||
|
@@ -8,6 +8,8 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_INTERFACES_REGISTRY_HUB_H_INCLUDED
|
||||
|
||||
#include "catch_ptr.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
namespace Catch {
|
||||
@@ -29,7 +31,8 @@ namespace Catch {
|
||||
|
||||
struct IMutableRegistryHub {
|
||||
virtual ~IMutableRegistryHub();
|
||||
virtual void registerReporter( std::string const& name, IReporterFactory* factory ) = 0;
|
||||
virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) = 0;
|
||||
virtual void registerListener( Ptr<IReporterFactory> const& factory ) = 0;
|
||||
virtual void registerTest( TestCase const& testInfo ) = 0;
|
||||
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
||||
};
|
||||
|
@@ -26,18 +26,18 @@
|
||||
namespace Catch
|
||||
{
|
||||
struct ReporterConfig {
|
||||
explicit ReporterConfig( Ptr<IConfig> const& _fullConfig )
|
||||
explicit ReporterConfig( Ptr<IConfig const> const& _fullConfig )
|
||||
: m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
|
||||
|
||||
ReporterConfig( Ptr<IConfig> const& _fullConfig, std::ostream& _stream )
|
||||
ReporterConfig( Ptr<IConfig const> const& _fullConfig, std::ostream& _stream )
|
||||
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
|
||||
|
||||
std::ostream& stream() const { return *m_stream; }
|
||||
Ptr<IConfig> fullConfig() const { return m_fullConfig; }
|
||||
Ptr<IConfig const> fullConfig() const { return m_fullConfig; }
|
||||
|
||||
private:
|
||||
std::ostream* m_stream;
|
||||
Ptr<IConfig> m_fullConfig;
|
||||
Ptr<IConfig const> m_fullConfig;
|
||||
};
|
||||
|
||||
struct ReporterPreferences {
|
||||
@@ -240,6 +240,7 @@ namespace Catch
|
||||
|
||||
// The return value indicates if the messages buffer should be cleared:
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0;
|
||||
|
||||
virtual void sectionEnded( SectionStats const& sectionStats ) = 0;
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0;
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0;
|
||||
@@ -249,20 +250,24 @@ namespace Catch
|
||||
};
|
||||
|
||||
|
||||
struct IReporterFactory {
|
||||
struct IReporterFactory : IShared {
|
||||
virtual ~IReporterFactory();
|
||||
virtual IStreamingReporter* create( ReporterConfig const& config ) const = 0;
|
||||
virtual std::string getDescription() const = 0;
|
||||
};
|
||||
|
||||
struct IReporterRegistry {
|
||||
typedef std::map<std::string, IReporterFactory*> FactoryMap;
|
||||
typedef std::map<std::string, Ptr<IReporterFactory> > FactoryMap;
|
||||
typedef std::vector<Ptr<IReporterFactory> > Listeners;
|
||||
|
||||
virtual ~IReporterRegistry();
|
||||
virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig> const& config ) const = 0;
|
||||
virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig const> const& config ) const = 0;
|
||||
virtual FactoryMap const& getFactories() const = 0;
|
||||
virtual Listeners const& getListeners() const = 0;
|
||||
};
|
||||
|
||||
Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter );
|
||||
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_REPORTER_H_INCLUDED
|
||||
|
@@ -28,9 +28,13 @@ namespace Catch {
|
||||
struct ITestCaseRegistry {
|
||||
virtual ~ITestCaseRegistry();
|
||||
virtual std::vector<TestCase> const& getAllTests() const = 0;
|
||||
virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector<TestCase>& matchingTestCases, bool negated = false ) const = 0;
|
||||
|
||||
virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const = 0;
|
||||
};
|
||||
|
||||
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config );
|
||||
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config );
|
||||
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config );
|
||||
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_INTERFACES_TESTCASE_H_INCLUDED
|
||||
|
@@ -34,8 +34,7 @@ namespace Catch {
|
||||
nameAttr.setInitialIndent( 2 ).setIndent( 4 );
|
||||
tagsAttr.setIndent( 6 );
|
||||
|
||||
std::vector<TestCase> matchedTestCases;
|
||||
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, config, matchedTestCases );
|
||||
std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
|
||||
for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
@@ -63,8 +62,7 @@ namespace Catch {
|
||||
if( !config.testSpec().hasFilters() )
|
||||
testSpec = TestSpecParser( ITagAliasRegistry::get() ).parse( "*" ).testSpec();
|
||||
std::size_t matchedTests = 0;
|
||||
std::vector<TestCase> matchedTestCases;
|
||||
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, config, matchedTestCases );
|
||||
std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
|
||||
for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
@@ -104,8 +102,7 @@ namespace Catch {
|
||||
|
||||
std::map<std::string, TagInfo> tagCounts;
|
||||
|
||||
std::vector<TestCase> matchedTestCases;
|
||||
getRegistryHub().getTestCaseRegistry().getFilteredTests( testSpec, config, matchedTestCases );
|
||||
std::vector<TestCase> matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config );
|
||||
for( std::vector<TestCase>::const_iterator it = matchedTestCases.begin(), itEnd = matchedTestCases.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
|
@@ -32,6 +32,21 @@ namespace Matchers {
|
||||
};
|
||||
|
||||
namespace Generic {
|
||||
template<typename ExpressionT>
|
||||
struct Not : public MatcherImpl<Not<ExpressionT>, ExpressionT> {
|
||||
Not( Matcher<ExpressionT> const& matcher ) : m_matcher(matcher.clone()) {}
|
||||
Not( Not const& other ) : m_matcher( other.m_matcher ) {}
|
||||
|
||||
virtual bool match( ExpressionT const& expr ) const CATCH_OVERRIDE {
|
||||
return !m_matcher->match( expr );
|
||||
}
|
||||
|
||||
virtual std::string toString() const CATCH_OVERRIDE {
|
||||
return "not " + m_matcher->toString();
|
||||
}
|
||||
|
||||
Ptr< Matcher<ExpressionT> > m_matcher;
|
||||
};
|
||||
|
||||
template<typename ExpressionT>
|
||||
class AllOf : public MatcherImpl<AllOf<ExpressionT>, ExpressionT> {
|
||||
@@ -100,7 +115,6 @@ namespace Matchers {
|
||||
private:
|
||||
std::vector<Ptr<Matcher<ExpressionT> > > m_matchers;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
namespace StdString {
|
||||
@@ -204,6 +218,11 @@ namespace Matchers {
|
||||
|
||||
// The following functions create the actual matcher objects.
|
||||
// This allows the types to be inferred
|
||||
template<typename ExpressionT>
|
||||
inline Impl::Generic::Not<ExpressionT> Not( Impl::Matcher<ExpressionT> const& m ) {
|
||||
return Impl::Generic::Not<ExpressionT>( m );
|
||||
}
|
||||
|
||||
template<typename ExpressionT>
|
||||
inline Impl::Generic::AllOf<ExpressionT> AllOf( Impl::Matcher<ExpressionT> const& m1,
|
||||
Impl::Matcher<ExpressionT> const& m2 ) {
|
||||
|
@@ -26,24 +26,27 @@ namespace Catch {
|
||||
public: // IRegistryHub
|
||||
RegistryHub() {
|
||||
}
|
||||
virtual IReporterRegistry const& getReporterRegistry() const {
|
||||
virtual IReporterRegistry const& getReporterRegistry() const CATCH_OVERRIDE {
|
||||
return m_reporterRegistry;
|
||||
}
|
||||
virtual ITestCaseRegistry const& getTestCaseRegistry() const {
|
||||
virtual ITestCaseRegistry const& getTestCaseRegistry() const CATCH_OVERRIDE {
|
||||
return m_testCaseRegistry;
|
||||
}
|
||||
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() {
|
||||
virtual IExceptionTranslatorRegistry& getExceptionTranslatorRegistry() CATCH_OVERRIDE {
|
||||
return m_exceptionTranslatorRegistry;
|
||||
}
|
||||
|
||||
public: // IMutableRegistryHub
|
||||
virtual void registerReporter( std::string const& name, IReporterFactory* factory ) {
|
||||
virtual void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE {
|
||||
m_reporterRegistry.registerReporter( name, factory );
|
||||
}
|
||||
virtual void registerTest( TestCase const& testInfo ) {
|
||||
virtual void registerListener( Ptr<IReporterFactory> const& factory ) CATCH_OVERRIDE {
|
||||
m_reporterRegistry.registerListener( factory );
|
||||
}
|
||||
virtual void registerTest( TestCase const& testInfo ) CATCH_OVERRIDE {
|
||||
m_testCaseRegistry.registerTest( testInfo );
|
||||
}
|
||||
virtual void registerTranslator( const IExceptionTranslator* translator ) {
|
||||
virtual void registerTranslator( const IExceptionTranslator* translator ) CATCH_OVERRIDE {
|
||||
m_exceptionTranslatorRegistry.registerTranslator( translator );
|
||||
}
|
||||
|
||||
|
@@ -36,7 +36,7 @@ namespace Catch {
|
||||
template<typename T>
|
||||
class ReporterRegistrar {
|
||||
|
||||
class ReporterFactory : public IReporterFactory {
|
||||
class ReporterFactory : public SharedImpl<IReporterFactory> {
|
||||
|
||||
// *** Please Note ***:
|
||||
// - If you end up here looking at a compiler error because it's trying to register
|
||||
@@ -64,11 +64,35 @@ namespace Catch {
|
||||
getMutableRegistryHub().registerReporter( name, new ReporterFactory() );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
class ListenerRegistrar {
|
||||
|
||||
class ListenerFactory : public SharedImpl<IReporterFactory> {
|
||||
|
||||
virtual IStreamingReporter* create( ReporterConfig const& config ) const {
|
||||
return new T( config );
|
||||
}
|
||||
virtual std::string getDescription() const {
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
ListenerRegistrar() {
|
||||
getMutableRegistryHub().registerListener( new ListenerFactory() );
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#define INTERNAL_CATCH_REGISTER_LEGACY_REPORTER( name, reporterType ) \
|
||||
namespace{ Catch::LegacyReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||
|
||||
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
|
||||
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
|
||||
|
||||
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
|
||||
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_REPORTER_REGISTRARS_HPP_INCLUDED
|
||||
|
@@ -18,27 +18,32 @@ namespace Catch {
|
||||
|
||||
public:
|
||||
|
||||
virtual ~ReporterRegistry() {
|
||||
deleteAllValues( m_factories );
|
||||
}
|
||||
virtual ~ReporterRegistry() CATCH_OVERRIDE {}
|
||||
|
||||
virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig> const& config ) const {
|
||||
virtual IStreamingReporter* create( std::string const& name, Ptr<IConfig const> const& config ) const CATCH_OVERRIDE {
|
||||
FactoryMap::const_iterator it = m_factories.find( name );
|
||||
if( it == m_factories.end() )
|
||||
return CATCH_NULL;
|
||||
return it->second->create( ReporterConfig( config ) );
|
||||
}
|
||||
|
||||
void registerReporter( std::string const& name, IReporterFactory* factory ) {
|
||||
void registerReporter( std::string const& name, Ptr<IReporterFactory> const& factory ) {
|
||||
m_factories.insert( std::make_pair( name, factory ) );
|
||||
}
|
||||
void registerListener( Ptr<IReporterFactory> const& factory ) {
|
||||
m_listeners.push_back( factory );
|
||||
}
|
||||
|
||||
FactoryMap const& getFactories() const {
|
||||
virtual FactoryMap const& getFactories() const CATCH_OVERRIDE {
|
||||
return m_factories;
|
||||
}
|
||||
virtual Listeners const& getListeners() const CATCH_OVERRIDE {
|
||||
return m_listeners;
|
||||
}
|
||||
|
||||
private:
|
||||
FactoryMap m_factories;
|
||||
Listeners m_listeners;
|
||||
};
|
||||
}
|
||||
|
||||
|
@@ -64,10 +64,7 @@ namespace Catch {
|
||||
m_context( getCurrentMutableContext() ),
|
||||
m_activeTestCase( CATCH_NULL ),
|
||||
m_config( _config ),
|
||||
m_reporter( reporter ),
|
||||
m_prevRunner( m_context.getRunner() ),
|
||||
m_prevResultCapture( m_context.getResultCapture() ),
|
||||
m_prevConfig( m_context.getConfig() )
|
||||
m_reporter( reporter )
|
||||
{
|
||||
m_context.setRunner( this );
|
||||
m_context.setConfig( m_config );
|
||||
@@ -77,10 +74,6 @@ namespace Catch {
|
||||
|
||||
virtual ~RunContext() {
|
||||
m_reporter->testRunEnded( TestRunStats( m_runInfo, m_totals, aborting() ) );
|
||||
m_context.setRunner( m_prevRunner );
|
||||
m_context.setConfig( Ptr<IConfig const>() );
|
||||
m_context.setResultCapture( m_prevResultCapture );
|
||||
m_context.setConfig( m_prevConfig );
|
||||
}
|
||||
|
||||
void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ) {
|
||||
@@ -101,14 +94,18 @@ namespace Catch {
|
||||
m_reporter->testCaseStarting( testInfo );
|
||||
|
||||
m_activeTestCase = &testCase;
|
||||
m_testCaseTracker = TestCaseTracker( testInfo.name );
|
||||
|
||||
|
||||
do {
|
||||
m_trackerContext.startRun();
|
||||
do {
|
||||
m_trackerContext.startCycle();
|
||||
m_testCaseTracker = &SectionTracker::acquire( m_trackerContext, testInfo.name );
|
||||
runCurrentTest( redirectedCout, redirectedCerr );
|
||||
}
|
||||
while( !m_testCaseTracker->isCompleted() && !aborting() );
|
||||
while( !m_testCaseTracker->isSuccessfullyCompleted() && !aborting() );
|
||||
}
|
||||
// !TBD: deprecated - this will be replaced by indexed trackers
|
||||
while( getCurrentContext().advanceGeneratorsForCurrentTest() && !aborting() );
|
||||
|
||||
Totals deltaTotals = m_totals.delta( prevTotals );
|
||||
@@ -120,7 +117,7 @@ namespace Catch {
|
||||
aborting() ) );
|
||||
|
||||
m_activeTestCase = CATCH_NULL;
|
||||
m_testCaseTracker.reset();
|
||||
m_testCaseTracker = CATCH_NULL;
|
||||
|
||||
return deltaTotals;
|
||||
}
|
||||
@@ -156,9 +153,11 @@ namespace Catch {
|
||||
std::ostringstream oss;
|
||||
oss << sectionInfo.name << "@" << sectionInfo.lineInfo;
|
||||
|
||||
if( !m_testCaseTracker->enterSection( oss.str() ) )
|
||||
ITracker& sectionTracker = SectionTracker::acquire( m_trackerContext, oss.str() );
|
||||
if( !sectionTracker.isOpen() )
|
||||
return false;
|
||||
|
||||
m_activeSections.push_back( §ionTracker );
|
||||
|
||||
m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo;
|
||||
|
||||
m_reporter->sectionStarting( sectionInfo );
|
||||
@@ -168,30 +167,40 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
bool testForMissingAssertions( Counts& assertions ) {
|
||||
if( assertions.total() != 0 ||
|
||||
!m_config->warnAboutMissingAssertions() ||
|
||||
m_testCaseTracker->currentSectionHasChildren() )
|
||||
if( assertions.total() != 0 )
|
||||
return false;
|
||||
if( m_config->warnAboutMissingAssertions() )
|
||||
return false;
|
||||
if( m_trackerContext.currentTracker().hasChildren() )
|
||||
return false;
|
||||
m_totals.assertions.failed++;
|
||||
assertions.failed++;
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void sectionEnded( SectionInfo const& info, Counts const& prevAssertions, double _durationInSeconds ) {
|
||||
if( std::uncaught_exception() ) {
|
||||
m_unfinishedSections.push_back( UnfinishedSections( info, prevAssertions, _durationInSeconds ) );
|
||||
return;
|
||||
}
|
||||
|
||||
Counts assertions = m_totals.assertions - prevAssertions;
|
||||
|
||||
virtual void sectionEnded( SectionEndInfo const& endInfo ) {
|
||||
Counts assertions = m_totals.assertions - endInfo.prevAssertions;
|
||||
bool missingAssertions = testForMissingAssertions( assertions );
|
||||
|
||||
m_testCaseTracker->leaveSection();
|
||||
|
||||
m_reporter->sectionEnded( SectionStats( info, assertions, _durationInSeconds, missingAssertions ) );
|
||||
|
||||
if( !m_activeSections.empty() ) {
|
||||
m_activeSections.back()->close();
|
||||
m_activeSections.pop_back();
|
||||
}
|
||||
|
||||
m_reporter->sectionEnded( SectionStats( endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions ) );
|
||||
m_messages.clear();
|
||||
}
|
||||
|
||||
virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) {
|
||||
if( m_unfinishedSections.empty() )
|
||||
m_activeSections.back()->fail();
|
||||
else
|
||||
m_activeSections.back()->close();
|
||||
m_activeSections.pop_back();
|
||||
|
||||
m_unfinishedSections.push_back( endInfo );
|
||||
}
|
||||
|
||||
virtual void pushScopedMessage( MessageInfo const& message ) {
|
||||
m_messages.push_back( message );
|
||||
}
|
||||
@@ -257,7 +266,6 @@ namespace Catch {
|
||||
double duration = 0;
|
||||
try {
|
||||
m_lastAssertionInfo = AssertionInfo( "TEST_CASE", testCaseInfo.lineInfo, "", ResultDisposition::Normal );
|
||||
TestCaseTracker::Guard guard( *m_testCaseTracker );
|
||||
|
||||
seedRng( *m_config );
|
||||
|
||||
@@ -279,6 +287,7 @@ namespace Catch {
|
||||
catch(...) {
|
||||
makeUnexpectedResultBuilder().useActiveException();
|
||||
}
|
||||
m_testCaseTracker->close();
|
||||
handleUnfinishedSections();
|
||||
m_messages.clear();
|
||||
|
||||
@@ -309,43 +318,33 @@ namespace Catch {
|
||||
m_lastAssertionInfo.capturedExpression.c_str(),
|
||||
m_lastAssertionInfo.resultDisposition );
|
||||
}
|
||||
|
||||
|
||||
void handleUnfinishedSections() {
|
||||
// If sections ended prematurely due to an exception we stored their
|
||||
// infos here so we can tear them down outside the unwind process.
|
||||
for( std::vector<UnfinishedSections>::const_reverse_iterator it = m_unfinishedSections.rbegin(),
|
||||
for( std::vector<SectionEndInfo>::const_reverse_iterator it = m_unfinishedSections.rbegin(),
|
||||
itEnd = m_unfinishedSections.rend();
|
||||
it != itEnd;
|
||||
++it )
|
||||
sectionEnded( it->info, it->prevAssertions, it->durationInSeconds );
|
||||
sectionEnded( *it );
|
||||
m_unfinishedSections.clear();
|
||||
}
|
||||
|
||||
struct UnfinishedSections {
|
||||
UnfinishedSections( SectionInfo const& _info, Counts const& _prevAssertions, double _durationInSeconds )
|
||||
: info( _info ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds )
|
||||
{}
|
||||
|
||||
SectionInfo info;
|
||||
Counts prevAssertions;
|
||||
double durationInSeconds;
|
||||
};
|
||||
|
||||
TestRunInfo m_runInfo;
|
||||
IMutableContext& m_context;
|
||||
TestCase const* m_activeTestCase;
|
||||
Option<TestCaseTracker> m_testCaseTracker;
|
||||
ITracker* m_testCaseTracker;
|
||||
ITracker* m_currentSectionTracker;
|
||||
AssertionResult m_lastResult;
|
||||
|
||||
Ptr<IConfig const> m_config;
|
||||
Totals m_totals;
|
||||
Ptr<IStreamingReporter> m_reporter;
|
||||
std::vector<MessageInfo> m_messages;
|
||||
IRunner* m_prevRunner;
|
||||
IResultCapture* m_prevResultCapture;
|
||||
Ptr<IConfig const> m_prevConfig;
|
||||
AssertionInfo m_lastAssertionInfo;
|
||||
std::vector<UnfinishedSections> m_unfinishedSections;
|
||||
std::vector<SectionEndInfo> m_unfinishedSections;
|
||||
std::vector<ITracker*> m_activeSections;
|
||||
TrackerContext m_trackerContext;
|
||||
};
|
||||
|
||||
IResultCapture& getResultCapture() {
|
@@ -32,8 +32,13 @@ namespace Catch {
|
||||
}
|
||||
|
||||
Section::~Section() {
|
||||
if( m_sectionIncluded )
|
||||
getResultCapture().sectionEnded( m_info, m_assertions, m_timer.getElapsedSeconds() );
|
||||
if( m_sectionIncluded ) {
|
||||
SectionEndInfo endInfo( m_info, m_assertions, m_timer.getElapsedSeconds() );
|
||||
if( std::uncaught_exception() )
|
||||
getResultCapture().sectionEndedEarly( endInfo );
|
||||
else
|
||||
getResultCapture().sectionEnded( endInfo );
|
||||
}
|
||||
}
|
||||
|
||||
// This indicates whether the section should be executed or not
|
||||
|
@@ -9,6 +9,7 @@
|
||||
#define TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
|
||||
|
||||
#include "catch_common.h"
|
||||
#include "catch_totals.hpp"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
@@ -22,7 +23,17 @@ namespace Catch {
|
||||
std::string description;
|
||||
SourceLineInfo lineInfo;
|
||||
};
|
||||
|
||||
|
||||
struct SectionEndInfo {
|
||||
SectionEndInfo( SectionInfo const& _sectionInfo, Counts const& _prevAssertions, double _durationInSeconds )
|
||||
: sectionInfo( _sectionInfo ), prevAssertions( _prevAssertions ), durationInSeconds( _durationInSeconds )
|
||||
{}
|
||||
|
||||
SectionInfo sectionInfo;
|
||||
Counts prevAssertions;
|
||||
double durationInSeconds;
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_SECTION_INFO_H_INCLUDED
|
||||
|
@@ -9,28 +9,52 @@
|
||||
#ifndef TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
|
||||
|
||||
#include <streambuf>
|
||||
#include "catch_compiler_capabilities.h"
|
||||
#include "catch_streambuf.h"
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
#include <streambuf>
|
||||
#include <ostream>
|
||||
#include <fstream>
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class Stream {
|
||||
public:
|
||||
Stream();
|
||||
Stream( std::streambuf* _streamBuf, bool _isOwned );
|
||||
void release();
|
||||
|
||||
std::streambuf* streamBuf;
|
||||
|
||||
private:
|
||||
bool isOwned;
|
||||
};
|
||||
|
||||
std::ostream& cout();
|
||||
std::ostream& cerr();
|
||||
|
||||
|
||||
struct IStream {
|
||||
virtual ~IStream() CATCH_NOEXCEPT;
|
||||
virtual std::ostream& stream() const = 0;
|
||||
};
|
||||
|
||||
class FileStream : public IStream {
|
||||
mutable std::ofstream m_ofs;
|
||||
public:
|
||||
FileStream( std::string const& filename );
|
||||
public: // IStream
|
||||
virtual std::ostream& stream() const CATCH_OVERRIDE;
|
||||
};
|
||||
|
||||
|
||||
class CoutStream : public IStream {
|
||||
mutable std::ostream m_os;
|
||||
public:
|
||||
CoutStream();
|
||||
|
||||
public: // IStream
|
||||
virtual std::ostream& stream() const CATCH_OVERRIDE;
|
||||
};
|
||||
|
||||
|
||||
class DebugOutStream : public IStream {
|
||||
std::auto_ptr<StreamBufBase> m_streamBuf;
|
||||
mutable std::ostream m_os;
|
||||
public:
|
||||
DebugOutStream();
|
||||
|
||||
public: // IStream
|
||||
virtual std::ostream& stream() const CATCH_OVERRIDE;
|
||||
};
|
||||
}
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_STREAM_H_INCLUDED
|
||||
|
@@ -10,7 +10,6 @@
|
||||
#define TWOBLUECUBES_CATCH_STREAM_HPP_INCLUDED
|
||||
|
||||
#include "catch_stream.h"
|
||||
#include "catch_streambuf.h"
|
||||
#include "catch_debugger.h"
|
||||
|
||||
#include <stdexcept>
|
||||
@@ -57,29 +56,47 @@ namespace Catch {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
struct OutputDebugWriter {
|
||||
|
||||
FileStream::FileStream( std::string const& filename ) {
|
||||
m_ofs.open( filename.c_str() );
|
||||
if( m_ofs.fail() ) {
|
||||
std::ostringstream oss;
|
||||
oss << "Unable to open file: '" << filename << "'";
|
||||
throw std::domain_error( oss.str() );
|
||||
}
|
||||
}
|
||||
|
||||
std::ostream& FileStream::stream() const {
|
||||
return m_ofs;
|
||||
}
|
||||
|
||||
struct OutputDebugWriter {
|
||||
|
||||
void operator()( std::string const&str ) {
|
||||
writeToDebugConsole( str );
|
||||
}
|
||||
};
|
||||
|
||||
Stream::Stream()
|
||||
: streamBuf( CATCH_NULL ), isOwned( false )
|
||||
|
||||
DebugOutStream::DebugOutStream()
|
||||
: m_streamBuf( new StreamBufImpl<OutputDebugWriter>() ),
|
||||
m_os( m_streamBuf.get() )
|
||||
{}
|
||||
|
||||
Stream::Stream( std::streambuf* _streamBuf, bool _isOwned )
|
||||
: streamBuf( _streamBuf ), isOwned( _isOwned )
|
||||
{}
|
||||
|
||||
void Stream::release() {
|
||||
if( isOwned ) {
|
||||
delete streamBuf;
|
||||
streamBuf = CATCH_NULL;
|
||||
isOwned = false;
|
||||
}
|
||||
|
||||
std::ostream& DebugOutStream::stream() const {
|
||||
return m_os;
|
||||
}
|
||||
|
||||
// Store the streambuf from cout up-front because
|
||||
// cout may get redirected when running tests
|
||||
CoutStream::CoutStream()
|
||||
: m_os( Catch::cout().rdbuf() )
|
||||
{}
|
||||
|
||||
std::ostream& CoutStream::stream() const {
|
||||
return m_os;
|
||||
}
|
||||
|
||||
|
||||
#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement this functions
|
||||
std::ostream& cout() {
|
||||
return std::cout;
|
||||
|
@@ -5,9 +5,6 @@
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifndef TWOBLUECUBES_CATCH_SUPPRESS_WARNINGS_H_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_SUPPRESS_WARNINGS_H_INCLUDED
|
||||
|
||||
#ifdef __clang__
|
||||
# ifdef __ICC // icpc defines the __clang__ macro
|
||||
# pragma warning(push)
|
||||
@@ -22,6 +19,7 @@
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
# pragma clang diagnostic ignored "-Wswitch-enum"
|
||||
# pragma clang diagnostic ignored "-Wcovered-switch-default"
|
||||
# endif
|
||||
#elif defined __GNUC__
|
||||
# pragma GCC diagnostic ignored "-Wvariadic-macros"
|
||||
@@ -29,5 +27,3 @@
|
||||
# pragma GCC diagnostic push
|
||||
# pragma GCC diagnostic ignored "-Wpadded"
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_SUPPRESS_WARNINGS_H_INCLUDED
|
||||
|
@@ -21,14 +21,71 @@
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class TestRegistry : public ITestCaseRegistry {
|
||||
struct LexSort {
|
||||
bool operator() (TestCase i,TestCase j) const { return (i<j);}
|
||||
};
|
||||
struct RandomNumberGenerator {
|
||||
int operator()( int n ) const { return std::rand() % n; }
|
||||
};
|
||||
struct LexSort {
|
||||
bool operator() (TestCase i,TestCase j) const { return (i<j);}
|
||||
};
|
||||
struct RandomNumberGenerator {
|
||||
int operator()( int n ) const { return std::rand() % n; }
|
||||
};
|
||||
|
||||
inline std::vector<TestCase> sortTests( IConfig const& config, std::vector<TestCase> const& unsortedTestCases ) {
|
||||
|
||||
std::vector<TestCase> sorted = unsortedTestCases;
|
||||
|
||||
switch( config.runOrder() ) {
|
||||
case RunTests::InLexicographicalOrder:
|
||||
std::sort( sorted.begin(), sorted.end(), LexSort() );
|
||||
break;
|
||||
case RunTests::InRandomOrder:
|
||||
{
|
||||
seedRng( config );
|
||||
|
||||
RandomNumberGenerator rng;
|
||||
std::random_shuffle( sorted.begin(), sorted.end(), rng );
|
||||
}
|
||||
break;
|
||||
case RunTests::InDeclarationOrder:
|
||||
// already in declaration order
|
||||
break;
|
||||
}
|
||||
return sorted;
|
||||
}
|
||||
bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) {
|
||||
return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() );
|
||||
}
|
||||
|
||||
void enforceNoDuplicateTestCases( std::vector<TestCase> const& functions ) {
|
||||
std::set<TestCase> seenFunctions;
|
||||
for( std::vector<TestCase>::const_iterator it = functions.begin(), itEnd = functions.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
std::pair<std::set<TestCase>::const_iterator, bool> prev = seenFunctions.insert( *it );
|
||||
if( !prev.second ){
|
||||
Catch::cerr()
|
||||
<< Colour( Colour::Red )
|
||||
<< "error: TEST_CASE( \"" << it->name << "\" ) already defined.\n"
|
||||
<< "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n"
|
||||
<< "\tRedefined at " << it->getTestCaseInfo().lineInfo << std::endl;
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::vector<TestCase> filterTests( std::vector<TestCase> const& testCases, TestSpec const& testSpec, IConfig const& config ) {
|
||||
std::vector<TestCase> filtered;
|
||||
filtered.reserve( testCases.size() );
|
||||
for( std::vector<TestCase>::const_iterator it = testCases.begin(), itEnd = testCases.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
if( matchTest( *it, testSpec, config ) )
|
||||
filtered.push_back( *it );
|
||||
return filtered;
|
||||
}
|
||||
std::vector<TestCase> const& getAllTestCasesSorted( IConfig const& config ) {
|
||||
return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config );
|
||||
}
|
||||
|
||||
class TestRegistry : public ITestCaseRegistry {
|
||||
public:
|
||||
TestRegistry() : m_unnamedCount( 0 ) {}
|
||||
virtual ~TestRegistry();
|
||||
@@ -40,70 +97,27 @@ namespace Catch {
|
||||
oss << "Anonymous test case " << ++m_unnamedCount;
|
||||
return registerTest( testCase.withName( oss.str() ) );
|
||||
}
|
||||
|
||||
if( m_functions.find( testCase ) == m_functions.end() ) {
|
||||
m_functions.insert( testCase );
|
||||
m_functionsInOrder.push_back( testCase );
|
||||
if( !testCase.isHidden() )
|
||||
m_nonHiddenFunctions.push_back( testCase );
|
||||
}
|
||||
else {
|
||||
TestCase const& prev = *m_functions.find( testCase );
|
||||
{
|
||||
Colour colourGuard( Colour::Red );
|
||||
Catch::cerr() << "error: TEST_CASE( \"" << name << "\" ) already defined.\n"
|
||||
<< "\tFirst seen at " << prev.getTestCaseInfo().lineInfo << "\n"
|
||||
<< "\tRedefined at " << testCase.getTestCaseInfo().lineInfo << std::endl;
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
m_functions.push_back( testCase );
|
||||
}
|
||||
|
||||
virtual std::vector<TestCase> const& getAllTests() const {
|
||||
return m_functionsInOrder;
|
||||
return m_functions;
|
||||
}
|
||||
virtual std::vector<TestCase> const& getAllTestsSorted( IConfig const& config ) const {
|
||||
if( m_sortedFunctions.empty() )
|
||||
enforceNoDuplicateTestCases( m_functions );
|
||||
|
||||
virtual std::vector<TestCase> const& getAllNonHiddenTests() const {
|
||||
return m_nonHiddenFunctions;
|
||||
}
|
||||
|
||||
virtual void getFilteredTests( TestSpec const& testSpec, IConfig const& config, std::vector<TestCase>& matchingTestCases, bool negated = false ) const {
|
||||
|
||||
for( std::vector<TestCase>::const_iterator it = m_functionsInOrder.begin(),
|
||||
itEnd = m_functionsInOrder.end();
|
||||
it != itEnd;
|
||||
++it ) {
|
||||
bool includeTest = testSpec.matches( *it ) && ( config.allowThrows() || !it->throws() );
|
||||
if( includeTest != negated )
|
||||
matchingTestCases.push_back( *it );
|
||||
if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) {
|
||||
m_sortedFunctions = sortTests( config, m_functions );
|
||||
m_currentSortOrder = config.runOrder();
|
||||
}
|
||||
sortTests( config, matchingTestCases );
|
||||
return m_sortedFunctions;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
static void sortTests( IConfig const& config, std::vector<TestCase>& matchingTestCases ) {
|
||||
|
||||
switch( config.runOrder() ) {
|
||||
case RunTests::InLexicographicalOrder:
|
||||
std::sort( matchingTestCases.begin(), matchingTestCases.end(), LexSort() );
|
||||
break;
|
||||
case RunTests::InRandomOrder:
|
||||
{
|
||||
seedRng( config );
|
||||
|
||||
RandomNumberGenerator rng;
|
||||
std::random_shuffle( matchingTestCases.begin(), matchingTestCases.end(), rng );
|
||||
}
|
||||
break;
|
||||
case RunTests::InDeclarationOrder:
|
||||
// already in declaration order
|
||||
break;
|
||||
}
|
||||
}
|
||||
std::set<TestCase> m_functions;
|
||||
std::vector<TestCase> m_functionsInOrder;
|
||||
std::vector<TestCase> m_nonHiddenFunctions;
|
||||
std::vector<TestCase> m_functions;
|
||||
mutable RunTests::InWhatOrder m_currentSortOrder;
|
||||
mutable std::vector<TestCase> m_sortedFunctions;
|
||||
size_t m_unnamedCount;
|
||||
std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised
|
||||
};
|
||||
|
@@ -9,141 +9,307 @@
|
||||
#define TWOBLUECUBES_CATCH_TEST_CASE_TRACKER_HPP_INCLUDED
|
||||
|
||||
#include "catch_compiler_capabilities.h"
|
||||
#include "catch_ptr.hpp"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <assert.h>
|
||||
#include <vector>
|
||||
|
||||
namespace Catch {
|
||||
namespace SectionTracking {
|
||||
namespace TestCaseTracking {
|
||||
|
||||
class TrackedSection {
|
||||
struct ITracker : SharedImpl<> {
|
||||
virtual ~ITracker();
|
||||
|
||||
typedef std::map<std::string, TrackedSection> TrackedSections;
|
||||
// static queries
|
||||
virtual std::string name() const = 0;
|
||||
|
||||
// dynamic queries
|
||||
virtual bool isComplete() const = 0; // Successfully completed or failed
|
||||
virtual bool isSuccessfullyCompleted() const = 0;
|
||||
virtual bool isOpen() const = 0; // Started but not complete
|
||||
virtual bool hasChildren() const = 0;
|
||||
|
||||
virtual ITracker& parent() = 0;
|
||||
|
||||
// actions
|
||||
virtual void close() = 0; // Successfully complete
|
||||
virtual void fail() = 0;
|
||||
virtual void markAsNeedingAnotherRun() = 0;
|
||||
|
||||
virtual void addChild( Ptr<ITracker> const& child ) = 0;
|
||||
virtual ITracker* findChild( std::string const& name ) = 0;
|
||||
virtual void openChild() = 0;
|
||||
};
|
||||
|
||||
class TrackerContext {
|
||||
|
||||
public:
|
||||
enum RunState {
|
||||
NotStarted,
|
||||
Executing,
|
||||
ExecutingChildren,
|
||||
Completed
|
||||
CompletedCycle
|
||||
};
|
||||
|
||||
TrackedSection( std::string const& name, TrackedSection* parent )
|
||||
: m_name( name ), m_runState( NotStarted ), m_parent( parent )
|
||||
Ptr<ITracker> m_rootTracker;
|
||||
ITracker* m_currentTracker;
|
||||
RunState m_runState;
|
||||
|
||||
public:
|
||||
|
||||
static TrackerContext& instance() {
|
||||
static TrackerContext s_instance;
|
||||
return s_instance;
|
||||
}
|
||||
|
||||
TrackerContext()
|
||||
: m_currentTracker( CATCH_NULL ),
|
||||
m_runState( NotStarted )
|
||||
{}
|
||||
|
||||
RunState runState() const { return m_runState; }
|
||||
|
||||
TrackedSection* findChild( std::string const& childName );
|
||||
TrackedSection* acquireChild( std::string const& childName );
|
||||
|
||||
void enter() {
|
||||
if( m_runState == NotStarted )
|
||||
m_runState = Executing;
|
||||
ITracker& startRun();
|
||||
|
||||
void endRun() {
|
||||
m_rootTracker.reset();
|
||||
m_currentTracker = CATCH_NULL;
|
||||
m_runState = NotStarted;
|
||||
}
|
||||
void leave();
|
||||
|
||||
TrackedSection* getParent() {
|
||||
return m_parent;
|
||||
|
||||
void startCycle() {
|
||||
m_currentTracker = m_rootTracker.get();
|
||||
m_runState = Executing;
|
||||
}
|
||||
bool hasChildren() const {
|
||||
void completeCycle() {
|
||||
m_runState = CompletedCycle;
|
||||
}
|
||||
|
||||
bool completedCycle() const {
|
||||
return m_runState == CompletedCycle;
|
||||
}
|
||||
ITracker& currentTracker() {
|
||||
return *m_currentTracker;
|
||||
}
|
||||
void setCurrentTracker( ITracker* tracker ) {
|
||||
m_currentTracker = tracker;
|
||||
}
|
||||
};
|
||||
|
||||
class TrackerBase : public ITracker {
|
||||
protected:
|
||||
enum CycleState {
|
||||
NotStarted,
|
||||
Executing,
|
||||
ExecutingChildren,
|
||||
NeedsAnotherRun,
|
||||
CompletedSuccessfully,
|
||||
Failed
|
||||
};
|
||||
class TrackerHasName {
|
||||
std::string m_name;
|
||||
public:
|
||||
TrackerHasName( std::string const& name ) : m_name( name ) {}
|
||||
bool operator ()( Ptr<ITracker> const& tracker ) {
|
||||
return tracker->name() == m_name;
|
||||
}
|
||||
};
|
||||
typedef std::vector<Ptr<ITracker> > Children;
|
||||
std::string m_name;
|
||||
TrackerContext& m_ctx;
|
||||
ITracker* m_parent;
|
||||
Children m_children;
|
||||
CycleState m_runState;
|
||||
public:
|
||||
TrackerBase( std::string const& name, TrackerContext& ctx, ITracker* parent )
|
||||
: m_name( name ),
|
||||
m_ctx( ctx ),
|
||||
m_parent( parent ),
|
||||
m_runState( NotStarted )
|
||||
{}
|
||||
virtual ~TrackerBase();
|
||||
|
||||
virtual std::string name() const CATCH_OVERRIDE {
|
||||
return m_name;
|
||||
}
|
||||
virtual bool isComplete() const CATCH_OVERRIDE {
|
||||
return m_runState == CompletedSuccessfully || m_runState == Failed;
|
||||
}
|
||||
virtual bool isSuccessfullyCompleted() const CATCH_OVERRIDE {
|
||||
return m_runState == CompletedSuccessfully;
|
||||
}
|
||||
virtual bool isOpen() const CATCH_OVERRIDE {
|
||||
return m_runState != NotStarted && !isComplete();
|
||||
}
|
||||
virtual bool hasChildren() const CATCH_OVERRIDE {
|
||||
return !m_children.empty();
|
||||
}
|
||||
|
||||
|
||||
virtual void addChild( Ptr<ITracker> const& child ) CATCH_OVERRIDE {
|
||||
m_children.push_back( child );
|
||||
}
|
||||
|
||||
virtual ITracker* findChild( std::string const& name ) CATCH_OVERRIDE {
|
||||
Children::const_iterator it = std::find_if( m_children.begin(), m_children.end(), TrackerHasName( name ) );
|
||||
return( it != m_children.end() )
|
||||
? it->get()
|
||||
: CATCH_NULL;
|
||||
}
|
||||
virtual ITracker& parent() CATCH_OVERRIDE {
|
||||
assert( m_parent ); // Should always be non-null except for root
|
||||
return *m_parent;
|
||||
}
|
||||
|
||||
virtual void openChild() CATCH_OVERRIDE {
|
||||
if( m_runState != ExecutingChildren ) {
|
||||
m_runState = ExecutingChildren;
|
||||
if( m_parent )
|
||||
m_parent->openChild();
|
||||
}
|
||||
}
|
||||
void open() {
|
||||
m_runState = Executing;
|
||||
moveToThis();
|
||||
if( m_parent )
|
||||
m_parent->openChild();
|
||||
}
|
||||
|
||||
virtual void close() CATCH_OVERRIDE {
|
||||
|
||||
// Close any still open children (e.g. generators)
|
||||
while( &m_ctx.currentTracker() != this )
|
||||
m_ctx.currentTracker().close();
|
||||
|
||||
switch( m_runState ) {
|
||||
case NotStarted:
|
||||
case CompletedSuccessfully:
|
||||
case Failed:
|
||||
throw std::logic_error( "Illogical state" );
|
||||
|
||||
case NeedsAnotherRun:
|
||||
break;;
|
||||
|
||||
case Executing:
|
||||
m_runState = CompletedSuccessfully;
|
||||
break;
|
||||
case ExecutingChildren:
|
||||
if( m_children.empty() || m_children.back()->isComplete() )
|
||||
m_runState = CompletedSuccessfully;
|
||||
break;
|
||||
|
||||
default:
|
||||
throw std::logic_error( "Unexpected state" );
|
||||
}
|
||||
moveToParent();
|
||||
m_ctx.completeCycle();
|
||||
}
|
||||
virtual void fail() CATCH_OVERRIDE {
|
||||
m_runState = Failed;
|
||||
if( m_parent )
|
||||
m_parent->markAsNeedingAnotherRun();
|
||||
moveToParent();
|
||||
m_ctx.completeCycle();
|
||||
}
|
||||
virtual void markAsNeedingAnotherRun() CATCH_OVERRIDE {
|
||||
m_runState = NeedsAnotherRun;
|
||||
}
|
||||
private:
|
||||
std::string m_name;
|
||||
RunState m_runState;
|
||||
TrackedSections m_children;
|
||||
TrackedSection* m_parent;
|
||||
void moveToParent() {
|
||||
assert( m_parent );
|
||||
m_ctx.setCurrentTracker( m_parent );
|
||||
}
|
||||
void moveToThis() {
|
||||
m_ctx.setCurrentTracker( this );
|
||||
}
|
||||
};
|
||||
|
||||
inline TrackedSection* TrackedSection::findChild( std::string const& childName ) {
|
||||
TrackedSections::iterator it = m_children.find( childName );
|
||||
return it != m_children.end()
|
||||
? &it->second
|
||||
: CATCH_NULL;
|
||||
}
|
||||
inline TrackedSection* TrackedSection::acquireChild( std::string const& childName ) {
|
||||
if( TrackedSection* child = findChild( childName ) )
|
||||
return child;
|
||||
m_children.insert( std::make_pair( childName, TrackedSection( childName, this ) ) );
|
||||
return findChild( childName );
|
||||
}
|
||||
inline void TrackedSection::leave() {
|
||||
for( TrackedSections::const_iterator it = m_children.begin(), itEnd = m_children.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
if( it->second.runState() != Completed ) {
|
||||
m_runState = ExecutingChildren;
|
||||
return;
|
||||
}
|
||||
m_runState = Completed;
|
||||
}
|
||||
|
||||
class TestCaseTracker {
|
||||
class SectionTracker : public TrackerBase {
|
||||
public:
|
||||
TestCaseTracker( std::string const& testCaseName )
|
||||
: m_testCase( testCaseName, CATCH_NULL ),
|
||||
m_currentSection( &m_testCase ),
|
||||
m_completedASectionThisRun( false )
|
||||
SectionTracker( std::string const& name, TrackerContext& ctx, ITracker* parent )
|
||||
: TrackerBase( name, ctx, parent )
|
||||
{}
|
||||
|
||||
bool enterSection( std::string const& name ) {
|
||||
TrackedSection* child = m_currentSection->acquireChild( name );
|
||||
if( m_completedASectionThisRun || child->runState() == TrackedSection::Completed )
|
||||
return false;
|
||||
|
||||
m_currentSection = child;
|
||||
m_currentSection->enter();
|
||||
return true;
|
||||
}
|
||||
void leaveSection() {
|
||||
m_currentSection->leave();
|
||||
m_currentSection = m_currentSection->getParent();
|
||||
assert( m_currentSection != CATCH_NULL );
|
||||
m_completedASectionThisRun = true;
|
||||
}
|
||||
|
||||
bool currentSectionHasChildren() const {
|
||||
return m_currentSection->hasChildren();
|
||||
}
|
||||
bool isCompleted() const {
|
||||
return m_testCase.runState() == TrackedSection::Completed;
|
||||
}
|
||||
|
||||
class Guard {
|
||||
public:
|
||||
Guard( TestCaseTracker& tracker ) : m_tracker( tracker ) {
|
||||
m_tracker.enterTestCase();
|
||||
virtual ~SectionTracker();
|
||||
|
||||
static SectionTracker& acquire( TrackerContext& ctx, std::string const& name ) {
|
||||
SectionTracker* section = CATCH_NULL;
|
||||
|
||||
ITracker& currentTracker = ctx.currentTracker();
|
||||
if( ITracker* childTracker = currentTracker.findChild( name ) ) {
|
||||
section = dynamic_cast<SectionTracker*>( childTracker );
|
||||
assert( section );
|
||||
}
|
||||
~Guard() {
|
||||
m_tracker.leaveTestCase();
|
||||
else {
|
||||
section = new SectionTracker( name, ctx, ¤tTracker );
|
||||
currentTracker.addChild( section );
|
||||
}
|
||||
private:
|
||||
Guard( Guard const& );
|
||||
void operator = ( Guard const& );
|
||||
TestCaseTracker& m_tracker;
|
||||
};
|
||||
|
||||
private:
|
||||
void enterTestCase() {
|
||||
m_currentSection = &m_testCase;
|
||||
m_completedASectionThisRun = false;
|
||||
m_testCase.enter();
|
||||
if( !ctx.completedCycle() && !section->isComplete() ) {
|
||||
|
||||
section->open();
|
||||
}
|
||||
return *section;
|
||||
}
|
||||
void leaveTestCase() {
|
||||
m_testCase.leave();
|
||||
}
|
||||
|
||||
TrackedSection m_testCase;
|
||||
TrackedSection* m_currentSection;
|
||||
bool m_completedASectionThisRun;
|
||||
};
|
||||
|
||||
} // namespace SectionTracking
|
||||
|
||||
using SectionTracking::TestCaseTracker;
|
||||
|
||||
class IndexTracker : public TrackerBase {
|
||||
int m_size;
|
||||
int m_index;
|
||||
public:
|
||||
IndexTracker( std::string const& name, TrackerContext& ctx, ITracker* parent, int size )
|
||||
: TrackerBase( name, ctx, parent ),
|
||||
m_size( size ),
|
||||
m_index( -1 )
|
||||
{}
|
||||
virtual ~IndexTracker();
|
||||
|
||||
static IndexTracker& acquire( TrackerContext& ctx, std::string const& name, int size ) {
|
||||
IndexTracker* tracker = CATCH_NULL;
|
||||
|
||||
ITracker& currentTracker = ctx.currentTracker();
|
||||
if( ITracker* childTracker = currentTracker.findChild( name ) ) {
|
||||
tracker = dynamic_cast<IndexTracker*>( childTracker );
|
||||
assert( tracker );
|
||||
}
|
||||
else {
|
||||
tracker = new IndexTracker( name, ctx, ¤tTracker, size );
|
||||
currentTracker.addChild( tracker );
|
||||
}
|
||||
|
||||
if( !ctx.completedCycle() && !tracker->isComplete() ) {
|
||||
if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun )
|
||||
tracker->moveNext();
|
||||
tracker->open();
|
||||
}
|
||||
|
||||
return *tracker;
|
||||
}
|
||||
|
||||
int index() const { return m_index; }
|
||||
|
||||
void moveNext() {
|
||||
m_index++;
|
||||
m_children.clear();
|
||||
}
|
||||
|
||||
virtual void close() CATCH_OVERRIDE {
|
||||
TrackerBase::close();
|
||||
if( m_runState == CompletedSuccessfully && m_index < m_size-1 )
|
||||
m_runState = Executing;
|
||||
}
|
||||
};
|
||||
|
||||
inline ITracker& TrackerContext::startRun() {
|
||||
m_rootTracker = new SectionTracker( "{root}", *this, CATCH_NULL );
|
||||
m_currentTracker = CATCH_NULL;
|
||||
m_runState = Executing;
|
||||
return *m_rootTracker;
|
||||
}
|
||||
|
||||
} // namespace TestCaseTracking
|
||||
|
||||
using TestCaseTracking::ITracker;
|
||||
using TestCaseTracking::TrackerContext;
|
||||
using TestCaseTracking::SectionTracker;
|
||||
using TestCaseTracking::IndexTracker;
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
|
@@ -37,7 +37,7 @@ namespace Catch {
|
||||
return os;
|
||||
}
|
||||
|
||||
Version libraryVersion( 1, 2, 1, "develop", 11 );
|
||||
Version libraryVersion( 1, 2, 1, "develop", 15 );
|
||||
|
||||
}
|
||||
|
||||
|
@@ -19,47 +19,53 @@ namespace Catch {
|
||||
StreamingReporterBase( ReporterConfig const& _config )
|
||||
: m_config( _config.fullConfig() ),
|
||||
stream( _config.stream() )
|
||||
{}
|
||||
{
|
||||
m_reporterPrefs.shouldRedirectStdOut = false;
|
||||
}
|
||||
|
||||
virtual ~StreamingReporterBase();
|
||||
virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE {
|
||||
return m_reporterPrefs;
|
||||
}
|
||||
|
||||
virtual void noMatchingTestCases( std::string const& ) {}
|
||||
virtual ~StreamingReporterBase() CATCH_OVERRIDE;
|
||||
|
||||
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) {
|
||||
virtual void noMatchingTestCases( std::string const& ) CATCH_OVERRIDE {}
|
||||
|
||||
virtual void testRunStarting( TestRunInfo const& _testRunInfo ) CATCH_OVERRIDE {
|
||||
currentTestRunInfo = _testRunInfo;
|
||||
}
|
||||
virtual void testGroupStarting( GroupInfo const& _groupInfo ) {
|
||||
virtual void testGroupStarting( GroupInfo const& _groupInfo ) CATCH_OVERRIDE {
|
||||
currentGroupInfo = _groupInfo;
|
||||
}
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& _testInfo ) {
|
||||
virtual void testCaseStarting( TestCaseInfo const& _testInfo ) CATCH_OVERRIDE {
|
||||
currentTestCaseInfo = _testInfo;
|
||||
}
|
||||
virtual void sectionStarting( SectionInfo const& _sectionInfo ) {
|
||||
virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE {
|
||||
m_sectionStack.push_back( _sectionInfo );
|
||||
}
|
||||
|
||||
virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) {
|
||||
virtual void sectionEnded( SectionStats const& /* _sectionStats */ ) CATCH_OVERRIDE {
|
||||
m_sectionStack.pop_back();
|
||||
}
|
||||
virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) {
|
||||
virtual void testCaseEnded( TestCaseStats const& /* _testCaseStats */ ) CATCH_OVERRIDE {
|
||||
currentTestCaseInfo.reset();
|
||||
}
|
||||
virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) {
|
||||
virtual void testGroupEnded( TestGroupStats const& /* _testGroupStats */ ) CATCH_OVERRIDE {
|
||||
currentGroupInfo.reset();
|
||||
}
|
||||
virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) {
|
||||
virtual void testRunEnded( TestRunStats const& /* _testRunStats */ ) CATCH_OVERRIDE {
|
||||
currentTestCaseInfo.reset();
|
||||
currentGroupInfo.reset();
|
||||
currentTestRunInfo.reset();
|
||||
}
|
||||
|
||||
virtual void skipTest( TestCaseInfo const& ) {
|
||||
virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE {
|
||||
// Don't do anything with this by default.
|
||||
// It can optionally be overridden in the derived class.
|
||||
}
|
||||
|
||||
Ptr<IConfig> m_config;
|
||||
Ptr<IConfig const> m_config;
|
||||
std::ostream& stream;
|
||||
|
||||
LazyStat<TestRunInfo> currentTestRunInfo;
|
||||
@@ -67,6 +73,7 @@ namespace Catch {
|
||||
LazyStat<TestCaseInfo> currentTestCaseInfo;
|
||||
|
||||
std::vector<SectionInfo> m_sectionStack;
|
||||
ReporterPreferences m_reporterPrefs;
|
||||
};
|
||||
|
||||
struct CumulativeReporterBase : SharedImpl<IStreamingReporter> {
|
||||
@@ -118,15 +125,21 @@ namespace Catch {
|
||||
CumulativeReporterBase( ReporterConfig const& _config )
|
||||
: m_config( _config.fullConfig() ),
|
||||
stream( _config.stream() )
|
||||
{}
|
||||
{
|
||||
m_reporterPrefs.shouldRedirectStdOut = false;
|
||||
}
|
||||
~CumulativeReporterBase();
|
||||
|
||||
virtual void testRunStarting( TestRunInfo const& ) {}
|
||||
virtual void testGroupStarting( GroupInfo const& ) {}
|
||||
virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE {
|
||||
return m_reporterPrefs;
|
||||
}
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& ) {}
|
||||
virtual void testRunStarting( TestRunInfo const& ) CATCH_OVERRIDE {}
|
||||
virtual void testGroupStarting( GroupInfo const& ) CATCH_OVERRIDE {}
|
||||
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
virtual void testCaseStarting( TestCaseInfo const& ) CATCH_OVERRIDE {}
|
||||
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE {
|
||||
SectionStats incompleteStats( sectionInfo, Counts(), 0, false );
|
||||
Ptr<SectionNode> node;
|
||||
if( m_sectionStack.empty() ) {
|
||||
@@ -151,7 +164,7 @@ namespace Catch {
|
||||
m_deepestSection = node;
|
||||
}
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& ) {}
|
||||
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {}
|
||||
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
|
||||
assert( !m_sectionStack.empty() );
|
||||
@@ -159,13 +172,13 @@ namespace Catch {
|
||||
sectionNode.assertions.push_back( assertionStats );
|
||||
return true;
|
||||
}
|
||||
virtual void sectionEnded( SectionStats const& sectionStats ) {
|
||||
virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE {
|
||||
assert( !m_sectionStack.empty() );
|
||||
SectionNode& node = *m_sectionStack.back();
|
||||
node.stats = sectionStats;
|
||||
m_sectionStack.pop_back();
|
||||
}
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE {
|
||||
Ptr<TestCaseNode> node = new TestCaseNode( testCaseStats );
|
||||
assert( m_sectionStack.size() == 0 );
|
||||
node->children.push_back( m_rootSection );
|
||||
@@ -176,12 +189,12 @@ namespace Catch {
|
||||
m_deepestSection->stdOut = testCaseStats.stdOut;
|
||||
m_deepestSection->stdErr = testCaseStats.stdErr;
|
||||
}
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE {
|
||||
Ptr<TestGroupNode> node = new TestGroupNode( testGroupStats );
|
||||
node->children.swap( m_testCases );
|
||||
m_testGroups.push_back( node );
|
||||
}
|
||||
virtual void testRunEnded( TestRunStats const& testRunStats ) {
|
||||
virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE {
|
||||
Ptr<TestRunNode> node = new TestRunNode( testRunStats );
|
||||
node->children.swap( m_testGroups );
|
||||
m_testRuns.push_back( node );
|
||||
@@ -189,9 +202,9 @@ namespace Catch {
|
||||
}
|
||||
virtual void testRunEndedCumulative() = 0;
|
||||
|
||||
virtual void skipTest( TestCaseInfo const& ) {}
|
||||
virtual void skipTest( TestCaseInfo const& ) CATCH_OVERRIDE {}
|
||||
|
||||
Ptr<IConfig> m_config;
|
||||
Ptr<IConfig const> m_config;
|
||||
std::ostream& stream;
|
||||
std::vector<AssertionStats> m_assertions;
|
||||
std::vector<std::vector<Ptr<SectionNode> > > m_sections;
|
||||
@@ -203,6 +216,7 @@ namespace Catch {
|
||||
Ptr<SectionNode> m_rootSection;
|
||||
Ptr<SectionNode> m_deepestSection;
|
||||
std::vector<Ptr<SectionNode> > m_sectionStack;
|
||||
ReporterPreferences m_reporterPrefs;
|
||||
|
||||
};
|
||||
|
||||
@@ -216,6 +230,18 @@ namespace Catch {
|
||||
return line;
|
||||
}
|
||||
|
||||
|
||||
struct TestEventListenerBase : StreamingReporterBase {
|
||||
TestEventListenerBase( ReporterConfig const& _config )
|
||||
: StreamingReporterBase( _config )
|
||||
{}
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {}
|
||||
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_REPORTER_BASES_HPP_INCLUDED
|
||||
|
@@ -21,24 +21,19 @@ namespace Catch {
|
||||
m_headerPrinted( false )
|
||||
{}
|
||||
|
||||
virtual ~ConsoleReporter();
|
||||
virtual ~ConsoleReporter() CATCH_OVERRIDE;
|
||||
static std::string getDescription() {
|
||||
return "Reports test results as plain lines of text";
|
||||
}
|
||||
virtual ReporterPreferences getPreferences() const {
|
||||
ReporterPreferences prefs;
|
||||
prefs.shouldRedirectStdOut = false;
|
||||
return prefs;
|
||||
}
|
||||
|
||||
virtual void noMatchingTestCases( std::string const& spec ) {
|
||||
virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE {
|
||||
stream << "No test cases matched '" << spec << "'" << std::endl;
|
||||
}
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& ) {
|
||||
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {
|
||||
}
|
||||
|
||||
virtual bool assertionEnded( AssertionStats const& _assertionStats ) {
|
||||
virtual bool assertionEnded( AssertionStats const& _assertionStats ) CATCH_OVERRIDE {
|
||||
AssertionResult const& result = _assertionStats.assertionResult;
|
||||
|
||||
bool printInfoMessages = true;
|
||||
@@ -58,11 +53,11 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void sectionStarting( SectionInfo const& _sectionInfo ) {
|
||||
virtual void sectionStarting( SectionInfo const& _sectionInfo ) CATCH_OVERRIDE {
|
||||
m_headerPrinted = false;
|
||||
StreamingReporterBase::sectionStarting( _sectionInfo );
|
||||
}
|
||||
virtual void sectionEnded( SectionStats const& _sectionStats ) {
|
||||
virtual void sectionEnded( SectionStats const& _sectionStats ) CATCH_OVERRIDE {
|
||||
if( _sectionStats.missingAssertions ) {
|
||||
lazyPrint();
|
||||
Colour colour( Colour::ResultError );
|
||||
@@ -84,11 +79,11 @@ namespace Catch {
|
||||
StreamingReporterBase::sectionEnded( _sectionStats );
|
||||
}
|
||||
|
||||
virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) {
|
||||
virtual void testCaseEnded( TestCaseStats const& _testCaseStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseEnded( _testCaseStats );
|
||||
m_headerPrinted = false;
|
||||
}
|
||||
virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) {
|
||||
virtual void testGroupEnded( TestGroupStats const& _testGroupStats ) CATCH_OVERRIDE {
|
||||
if( currentGroupInfo.used ) {
|
||||
printSummaryDivider();
|
||||
stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n";
|
||||
@@ -97,7 +92,7 @@ namespace Catch {
|
||||
}
|
||||
StreamingReporterBase::testGroupEnded( _testGroupStats );
|
||||
}
|
||||
virtual void testRunEnded( TestRunStats const& _testRunStats ) {
|
||||
virtual void testRunEnded( TestRunStats const& _testRunStats ) CATCH_OVERRIDE {
|
||||
printTotalsDivider( _testRunStats.totals );
|
||||
printTotals( _testRunStats.totals );
|
||||
stream << std::endl;
|
||||
|
@@ -23,28 +23,24 @@ namespace Catch {
|
||||
JunitReporter( ReporterConfig const& _config )
|
||||
: CumulativeReporterBase( _config ),
|
||||
xml( _config.stream() )
|
||||
{}
|
||||
{
|
||||
m_reporterPrefs.shouldRedirectStdOut = true;
|
||||
}
|
||||
|
||||
~JunitReporter();
|
||||
virtual ~JunitReporter() CATCH_OVERRIDE;
|
||||
|
||||
static std::string getDescription() {
|
||||
return "Reports test results in an XML format that looks like Ant's junitreport target";
|
||||
}
|
||||
|
||||
virtual void noMatchingTestCases( std::string const& /*spec*/ ) {}
|
||||
virtual void noMatchingTestCases( std::string const& /*spec*/ ) CATCH_OVERRIDE {}
|
||||
|
||||
virtual ReporterPreferences getPreferences() const {
|
||||
ReporterPreferences prefs;
|
||||
prefs.shouldRedirectStdOut = true;
|
||||
return prefs;
|
||||
}
|
||||
|
||||
virtual void testRunStarting( TestRunInfo const& runInfo ) {
|
||||
virtual void testRunStarting( TestRunInfo const& runInfo ) CATCH_OVERRIDE {
|
||||
CumulativeReporterBase::testRunStarting( runInfo );
|
||||
xml.startElement( "testsuites" );
|
||||
}
|
||||
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE {
|
||||
suiteTimer.start();
|
||||
stdOutForSuite.str("");
|
||||
stdErrForSuite.str("");
|
||||
@@ -52,25 +48,25 @@ namespace Catch {
|
||||
CumulativeReporterBase::testGroupStarting( groupInfo );
|
||||
}
|
||||
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
||||
if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException )
|
||||
unexpectedExceptions++;
|
||||
return CumulativeReporterBase::assertionEnded( assertionStats );
|
||||
}
|
||||
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE {
|
||||
stdOutForSuite << testCaseStats.stdOut;
|
||||
stdErrForSuite << testCaseStats.stdErr;
|
||||
CumulativeReporterBase::testCaseEnded( testCaseStats );
|
||||
}
|
||||
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE {
|
||||
double suiteTime = suiteTimer.getElapsedSeconds();
|
||||
CumulativeReporterBase::testGroupEnded( testGroupStats );
|
||||
writeGroup( *m_testGroups.back(), suiteTime );
|
||||
}
|
||||
|
||||
virtual void testRunEndedCumulative() {
|
||||
virtual void testRunEndedCumulative() CATCH_OVERRIDE {
|
||||
xml.endElement();
|
||||
}
|
||||
|
||||
|
147
include/reporters/catch_reporter_multi.hpp
Normal file
147
include/reporters/catch_reporter_multi.hpp
Normal file
@@ -0,0 +1,147 @@
|
||||
/*
|
||||
* Created by Phil on 5/08/2015.
|
||||
* Copyright 2015 Two Blue Cubes Ltd. All rights reserved.
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#ifndef TWOBLUECUBES_CATCH_REPORTER_MULTI_HPP_INCLUDED
|
||||
#define TWOBLUECUBES_CATCH_REPORTER_MULTI_HPP_INCLUDED
|
||||
|
||||
#include "../internal/catch_interfaces_reporter.h"
|
||||
|
||||
namespace Catch {
|
||||
|
||||
class MultipleReporters : public SharedImpl<IStreamingReporter> {
|
||||
typedef std::vector<Ptr<IStreamingReporter> > Reporters;
|
||||
Reporters m_reporters;
|
||||
|
||||
public:
|
||||
void add( Ptr<IStreamingReporter> const& reporter ) {
|
||||
m_reporters.push_back( reporter );
|
||||
}
|
||||
|
||||
public: // IStreamingReporter
|
||||
|
||||
virtual ReporterPreferences getPreferences() const CATCH_OVERRIDE {
|
||||
return m_reporters[0]->getPreferences();
|
||||
}
|
||||
|
||||
virtual void noMatchingTestCases( std::string const& spec ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->noMatchingTestCases( spec );
|
||||
}
|
||||
|
||||
|
||||
virtual void testRunStarting( TestRunInfo const& testRunInfo ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->testRunStarting( testRunInfo );
|
||||
}
|
||||
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->testGroupStarting( groupInfo );
|
||||
}
|
||||
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->testCaseStarting( testInfo );
|
||||
}
|
||||
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->sectionStarting( sectionInfo );
|
||||
}
|
||||
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& assertionInfo ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->assertionStarting( assertionInfo );
|
||||
}
|
||||
|
||||
|
||||
// The return value indicates if the messages buffer should be cleared:
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
||||
bool clearBuffer = false;
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
clearBuffer |= (*it)->assertionEnded( assertionStats );
|
||||
return clearBuffer;
|
||||
}
|
||||
|
||||
virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->sectionEnded( sectionStats );
|
||||
}
|
||||
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->testCaseEnded( testCaseStats );
|
||||
}
|
||||
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->testGroupEnded( testGroupStats );
|
||||
}
|
||||
|
||||
virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->testRunEnded( testRunStats );
|
||||
}
|
||||
|
||||
|
||||
virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
for( Reporters::const_iterator it = m_reporters.begin(), itEnd = m_reporters.end();
|
||||
it != itEnd;
|
||||
++it )
|
||||
(*it)->skipTest( testInfo );
|
||||
}
|
||||
};
|
||||
|
||||
Ptr<IStreamingReporter> addReporter( Ptr<IStreamingReporter> const& existingReporter, Ptr<IStreamingReporter> const& additionalReporter ) {
|
||||
Ptr<IStreamingReporter> resultingReporter;
|
||||
|
||||
if( existingReporter ) {
|
||||
MultipleReporters* multi = dynamic_cast<MultipleReporters*>( existingReporter.get() );
|
||||
if( !multi ) {
|
||||
multi = new MultipleReporters;
|
||||
resultingReporter = Ptr<IStreamingReporter>( multi );
|
||||
if( existingReporter )
|
||||
multi->add( existingReporter );
|
||||
}
|
||||
else
|
||||
resultingReporter = existingReporter;
|
||||
multi->add( additionalReporter );
|
||||
}
|
||||
else
|
||||
resultingReporter = additionalReporter;
|
||||
|
||||
return resultingReporter;
|
||||
}
|
||||
|
||||
|
||||
} // end namespace Catch
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_REPORTER_MULTI_HPP_INCLUDED
|
@@ -17,8 +17,10 @@
|
||||
#include <cstring>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic push
|
||||
#pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic push
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#endif
|
||||
|
||||
namespace Catch {
|
||||
@@ -27,7 +29,9 @@ namespace Catch {
|
||||
TeamCityReporter( ReporterConfig const& _config )
|
||||
: StreamingReporterBase( _config ),
|
||||
m_headerPrintedForThisSection( false )
|
||||
{}
|
||||
{
|
||||
m_reporterPrefs.shouldRedirectStdOut = true;
|
||||
}
|
||||
|
||||
static std::string escape( std::string const& str ) {
|
||||
std::string escaped = str;
|
||||
@@ -39,18 +43,13 @@ namespace Catch {
|
||||
replaceInPlace( escaped, "]", "|]" );
|
||||
return escaped;
|
||||
}
|
||||
virtual ~TeamCityReporter();
|
||||
virtual ~TeamCityReporter() CATCH_OVERRIDE;
|
||||
|
||||
static std::string getDescription() {
|
||||
return "Reports test results as TeamCity service messages";
|
||||
}
|
||||
virtual ReporterPreferences getPreferences() const {
|
||||
ReporterPreferences prefs;
|
||||
prefs.shouldRedirectStdOut = true;
|
||||
return prefs;
|
||||
}
|
||||
|
||||
virtual void skipTest( TestCaseInfo const& testInfo ) {
|
||||
virtual void skipTest( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
stream << "##teamcity[testIgnored name='"
|
||||
<< escape( testInfo.name ) << "'";
|
||||
if( testInfo.isHidden() )
|
||||
@@ -60,24 +59,24 @@ namespace Catch {
|
||||
stream << "]\n";
|
||||
}
|
||||
|
||||
virtual void noMatchingTestCases( std::string const& /* spec */ ) {}
|
||||
virtual void noMatchingTestCases( std::string const& /* spec */ ) CATCH_OVERRIDE {}
|
||||
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testGroupStarting( groupInfo );
|
||||
stream << "##teamcity[testSuiteStarted name='"
|
||||
<< escape( groupInfo.name ) << "']\n";
|
||||
}
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testGroupEnded( testGroupStats );
|
||||
stream << "##teamcity[testSuiteFinished name='"
|
||||
<< escape( testGroupStats.groupInfo.name ) << "']\n";
|
||||
}
|
||||
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& ) {
|
||||
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE {
|
||||
}
|
||||
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
||||
AssertionResult const& result = assertionStats.assertionResult;
|
||||
if( !result.isOk() ) {
|
||||
|
||||
@@ -143,18 +142,18 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE {
|
||||
m_headerPrintedForThisSection = false;
|
||||
StreamingReporterBase::sectionStarting( sectionInfo );
|
||||
}
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseStarting( testInfo );
|
||||
stream << "##teamcity[testStarted name='"
|
||||
<< escape( testInfo.name ) << "']\n";
|
||||
}
|
||||
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseEnded( testCaseStats );
|
||||
if( !testCaseStats.stdOut.empty() )
|
||||
stream << "##teamcity[testStdOut name='"
|
||||
@@ -216,7 +215,7 @@ namespace Catch {
|
||||
} // end namespace Catch
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic pop
|
||||
# pragma clang diagnostic pop
|
||||
#endif
|
||||
|
||||
#endif // TWOBLUECUBES_CATCH_REPORTER_TEAMCITY_HPP_INCLUDED
|
||||
|
@@ -21,26 +21,23 @@ namespace Catch {
|
||||
XmlReporter( ReporterConfig const& _config )
|
||||
: StreamingReporterBase( _config ),
|
||||
m_sectionDepth( 0 )
|
||||
{}
|
||||
{
|
||||
m_reporterPrefs.shouldRedirectStdOut = true;
|
||||
}
|
||||
|
||||
virtual ~XmlReporter();
|
||||
virtual ~XmlReporter() CATCH_OVERRIDE;
|
||||
|
||||
static std::string getDescription() {
|
||||
return "Reports test results as an XML document";
|
||||
}
|
||||
|
||||
public: // StreamingReporterBase
|
||||
virtual ReporterPreferences getPreferences() const {
|
||||
ReporterPreferences prefs;
|
||||
prefs.shouldRedirectStdOut = true;
|
||||
return prefs;
|
||||
}
|
||||
|
||||
virtual void noMatchingTestCases( std::string const& s ) {
|
||||
virtual void noMatchingTestCases( std::string const& s ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::noMatchingTestCases( s );
|
||||
}
|
||||
|
||||
virtual void testRunStarting( TestRunInfo const& testInfo ) {
|
||||
virtual void testRunStarting( TestRunInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testRunStarting( testInfo );
|
||||
m_xml.setStream( stream );
|
||||
m_xml.startElement( "Catch" );
|
||||
@@ -48,13 +45,13 @@ namespace Catch {
|
||||
m_xml.writeAttribute( "name", m_config->name() );
|
||||
}
|
||||
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) {
|
||||
virtual void testGroupStarting( GroupInfo const& groupInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testGroupStarting( groupInfo );
|
||||
m_xml.startElement( "Group" )
|
||||
.writeAttribute( "name", groupInfo.name );
|
||||
}
|
||||
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) {
|
||||
virtual void testCaseStarting( TestCaseInfo const& testInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseStarting(testInfo);
|
||||
m_xml.startElement( "TestCase" ).writeAttribute( "name", trim( testInfo.name ) );
|
||||
|
||||
@@ -62,7 +59,7 @@ namespace Catch {
|
||||
m_testCaseTimer.start();
|
||||
}
|
||||
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) {
|
||||
virtual void sectionStarting( SectionInfo const& sectionInfo ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::sectionStarting( sectionInfo );
|
||||
if( m_sectionDepth++ > 0 ) {
|
||||
m_xml.startElement( "Section" )
|
||||
@@ -71,9 +68,9 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void assertionStarting( AssertionInfo const& ) { }
|
||||
virtual void assertionStarting( AssertionInfo const& ) CATCH_OVERRIDE { }
|
||||
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) {
|
||||
virtual bool assertionEnded( AssertionStats const& assertionStats ) CATCH_OVERRIDE {
|
||||
const AssertionResult& assertionResult = assertionStats.assertionResult;
|
||||
|
||||
// Print any info messages in <Info> tags.
|
||||
@@ -144,7 +141,7 @@ namespace Catch {
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void sectionEnded( SectionStats const& sectionStats ) {
|
||||
virtual void sectionEnded( SectionStats const& sectionStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::sectionEnded( sectionStats );
|
||||
if( --m_sectionDepth > 0 ) {
|
||||
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" );
|
||||
@@ -159,7 +156,7 @@ namespace Catch {
|
||||
}
|
||||
}
|
||||
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) {
|
||||
virtual void testCaseEnded( TestCaseStats const& testCaseStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testCaseEnded( testCaseStats );
|
||||
XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" );
|
||||
e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() );
|
||||
@@ -170,7 +167,7 @@ namespace Catch {
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) {
|
||||
virtual void testGroupEnded( TestGroupStats const& testGroupStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testGroupEnded( testGroupStats );
|
||||
// TODO: Check testGroupStats.aborting and act accordingly.
|
||||
m_xml.scopedElement( "OverallResults" )
|
||||
@@ -180,7 +177,7 @@ namespace Catch {
|
||||
m_xml.endElement();
|
||||
}
|
||||
|
||||
virtual void testRunEnded( TestRunStats const& testRunStats ) {
|
||||
virtual void testRunEnded( TestRunStats const& testRunStats ) CATCH_OVERRIDE {
|
||||
StreamingReporterBase::testRunEnded( testRunStats );
|
||||
m_xml.scopedElement( "OverallResults" )
|
||||
.writeAttribute( "successes", testRunStats.totals.assertions.passed )
|
||||
|
@@ -494,7 +494,27 @@ explicitly with message:
|
||||
Message from section two
|
||||
|
||||
Message from section one
|
||||
-------------------------------------------------------------------------------
|
||||
Standard output from all sections is reported
|
||||
one
|
||||
-------------------------------------------------------------------------------
|
||||
MessageTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
|
||||
No assertions in section 'one'
|
||||
|
||||
Message from section two
|
||||
-------------------------------------------------------------------------------
|
||||
Standard output from all sections is reported
|
||||
two
|
||||
-------------------------------------------------------------------------------
|
||||
MessageTests.cpp:<line number>
|
||||
...............................................................................
|
||||
|
||||
|
||||
No assertions in section 'two'
|
||||
|
||||
-------------------------------------------------------------------------------
|
||||
SCOPED_INFO is reset for each loop
|
||||
-------------------------------------------------------------------------------
|
||||
@@ -797,6 +817,6 @@ with expansion:
|
||||
"first" == "second"
|
||||
|
||||
===============================================================================
|
||||
test cases: 159 | 119 passed | 39 failed | 1 failed as expected
|
||||
assertions: 784 | 691 passed | 80 failed | 13 failed as expected
|
||||
test cases: 159 | 118 passed | 40 failed | 1 failed as expected
|
||||
assertions: 907 | 812 passed | 82 failed | 13 failed as expected
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,5 @@
|
||||
<testsuites>
|
||||
<testsuite name="CatchSelfTest" errors="12" failures="88" tests="804" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testsuite name="CatchSelfTest" errors="12" failures="68" tests="905" hostname="tbd" time="{duration}" timestamp="tbd">
|
||||
<testcase classname="global" name="toString(enum)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum w/operator<<)" time="{duration}"/>
|
||||
<testcase classname="global" name="toString(enum class)" time="{duration}"/>
|
||||
@@ -341,6 +341,11 @@ MessageTests.cpp:<line number>
|
||||
MiscTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="more nested SECTION tests" name="s1/s3" time="{duration}"/>
|
||||
<testcase classname="more nested SECTION tests" name="s1/s4" time="{duration}"/>
|
||||
<testcase classname="even more nested SECTION tests" name="c/d (leaf)" time="{duration}"/>
|
||||
<testcase classname="even more nested SECTION tests" name="c/e (leaf)" time="{duration}"/>
|
||||
<testcase classname="even more nested SECTION tests" name="f (leaf)" time="{duration}"/>
|
||||
<testcase classname="looped SECTION tests" name="s1" time="{duration}">
|
||||
<failure message="0 > 1" type="CHECK">
|
||||
MiscTests.cpp:<line number>
|
||||
@@ -399,6 +404,8 @@ MiscTests.cpp:<line number>
|
||||
MiscTests.cpp:<line number>
|
||||
</failure>
|
||||
</testcase>
|
||||
<testcase classname="xmlentitycheck" name="embedded xml" time="{duration}"/>
|
||||
<testcase classname="xmlentitycheck" name="encoded chars" time="{duration}"/>
|
||||
<testcase classname="global" name="send a single char to INFO" time="{duration}">
|
||||
<failure message="false" type="REQUIRE">
|
||||
3
|
||||
@@ -478,6 +485,7 @@ MiscTests.cpp:<line number>
|
||||
<testcase classname="Process can be configured on command line" name="test lists/Specify one test case exclusion using ~" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="reporter/-r/console" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="reporter/-r/xml" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="reporter/-r xml and junit" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="reporter/--reporter/junit" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="debugger/-b" time="{duration}"/>
|
||||
<testcase classname="Process can be configured on command line" name="debugger/--break" time="{duration}"/>
|
||||
@@ -565,6 +573,23 @@ TrickyTests.cpp:<line number>
|
||||
<testcase classname="global" name="toString( vectors<has_toString )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString( vectors<has_maker )" time="{duration}"/>
|
||||
<testcase classname="global" name="toString( vectors<has_maker_and_toString )" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="root" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="successfully close one section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="fail one section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="fail one section/re-enter after failed section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="fail one section/re-enter after failed section and find next section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="successfully close one section, then find another" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="successfully close one section, then find another/Re-enter - skips S1 and enters S2" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="successfully close one section, then find another/Re-enter - skips S1 and enters S2/Successfully close S2" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="successfully close one section, then find another/Re-enter - skips S1 and enters S2/fail S2" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="open a nested section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator/close outer section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator/close outer section/Re-enter for second generation" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator/Start a new inner section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator/Start a new inner section/Re-enter for second generation" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator/Fail an inner section" time="{duration}"/>
|
||||
<testcase classname="Tracker" name="start a generator/Fail an inner section/Re-enter for second generation" time="{duration}"/>
|
||||
<testcase classname="global" name="std::pair<int,std::string> -> toString" time="{duration}"/>
|
||||
<testcase classname="global" name="std::pair<int,const std::string> -> toString" time="{duration}"/>
|
||||
<testcase classname="global" name="std::vector<std::pair<std::string,int> > -> toString" time="{duration}"/>
|
||||
@@ -624,11 +649,6 @@ TrickyTests.cpp:<line number>
|
||||
<testcase classname="Scenario: This is a really long scenario name to see how the list command deals with wrapping" name="Given: A section name that is so long that it cannot fit in a single console width/When: The test headers are printed as part of the normal running of the scenario/Then: The, deliberately very long and overly verbose (you see what I did there?) section names must wrap, along with an indent" time="{duration}"/>
|
||||
<testcase classname="Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me" time="{duration}"/>
|
||||
<testcase classname="Fixture" name="Scenario: BDD tests requiring Fixtures to provide commonly-accessed data or methods/Given: No operations precede me/When: We get the count/Then: Subsequently values are higher" time="{duration}"/>
|
||||
<testcase classname="section tracking" name="root" time="{duration}"/>
|
||||
<testcase classname="section tracking" name="test case with no sections" time="{duration}"/>
|
||||
<testcase classname="section tracking" name="test case with one section" time="{duration}"/>
|
||||
<testcase classname="section tracking" name="test case with two consecutive sections" time="{duration}"/>
|
||||
<testcase classname="section tracking" name="test case with one section within another" time="{duration}"/>
|
||||
<system-out>
|
||||
Message from section one
|
||||
Message from section two
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -7,14 +7,16 @@
|
||||
*/
|
||||
|
||||
#include "catch.hpp"
|
||||
#include "internal/catch_xmlwriter.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#ifdef __clang__
|
||||
#pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat-pedantic"
|
||||
#endif
|
||||
|
||||
#include "../include/internal/catch_xmlwriter.hpp"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
TEST_CASE( "random SECTION tests", "[.][sections][failing]" )
|
||||
{
|
||||
int a = 1;
|
||||
@@ -78,15 +80,18 @@ TEST_CASE( "even more nested SECTION tests", "[sections]" )
|
||||
{
|
||||
SECTION( "d (leaf)", "" )
|
||||
{
|
||||
SUCCEED(""); // avoid failing due to no tests
|
||||
}
|
||||
|
||||
SECTION( "e (leaf)", "" )
|
||||
{
|
||||
SUCCEED(""); // avoid failing due to no tests
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "f (leaf)", "" )
|
||||
{
|
||||
SUCCEED(""); // avoid failing due to no tests
|
||||
}
|
||||
}
|
||||
|
||||
@@ -175,11 +180,11 @@ TEST_CASE( "xmlentitycheck", "" )
|
||||
{
|
||||
SECTION( "embedded xml", "<test>it should be possible to embed xml characters, such as <, \" or &, or even whole <xml>documents</xml> within an attribute</test>" )
|
||||
{
|
||||
// No test
|
||||
SUCCEED(""); // We need this here to stop it failing due to no tests
|
||||
}
|
||||
SECTION( "encoded chars", "these should all be encoded: &&&\"\"\"<<<&\"<<&\"" )
|
||||
{
|
||||
// No test
|
||||
SUCCEED(""); // We need this here to stop it failing due to no tests
|
||||
}
|
||||
}
|
||||
|
||||
|
328
projects/SelfTest/PartTrackerTests.cpp
Normal file
328
projects/SelfTest/PartTrackerTests.cpp
Normal file
@@ -0,0 +1,328 @@
|
||||
/*
|
||||
* Created by Phil on 1/10/2015.
|
||||
* Copyright 2015 Two Blue Cubes Ltd
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
#include "internal/catch_suppress_warnings.h"
|
||||
#include "internal/catch_test_case_tracker.hpp"
|
||||
|
||||
|
||||
namespace Catch
|
||||
{
|
||||
class LocalContext {
|
||||
|
||||
public:
|
||||
TrackerContext& operator()() const {
|
||||
return TrackerContext::instance();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Catch
|
||||
|
||||
inline Catch::TrackerContext& C_A_T_C_H_Context() {
|
||||
return Catch::TrackerContext::instance();
|
||||
}
|
||||
|
||||
// -------------------
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
using namespace Catch;
|
||||
|
||||
//inline void testCase( Catch::LocalContext const& C_A_T_C_H_Context ) {
|
||||
//
|
||||
// REQUIRE( C_A_T_C_H_Context().i() == 42 );
|
||||
//}
|
||||
|
||||
TEST_CASE( "Tracker", "" ) {
|
||||
|
||||
TrackerContext ctx;
|
||||
ctx.startRun();
|
||||
ctx.startCycle();
|
||||
|
||||
ITracker& testCase = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase.isOpen() );
|
||||
|
||||
ITracker& s1 = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1.isOpen() );
|
||||
|
||||
SECTION( "successfully close one section", "" ) {
|
||||
s1.close();
|
||||
REQUIRE( s1.isSuccessfullyCompleted() );
|
||||
REQUIRE( testCase.isComplete() == false );
|
||||
|
||||
testCase.close();
|
||||
REQUIRE( ctx.completedCycle() );
|
||||
REQUIRE( testCase.isSuccessfullyCompleted() );
|
||||
}
|
||||
|
||||
SECTION( "fail one section", "" ) {
|
||||
s1.fail();
|
||||
REQUIRE( s1.isComplete() );
|
||||
REQUIRE( s1.isSuccessfullyCompleted() == false );
|
||||
REQUIRE( testCase.isComplete() == false );
|
||||
|
||||
testCase.close();
|
||||
REQUIRE( ctx.completedCycle() );
|
||||
REQUIRE( testCase.isSuccessfullyCompleted() == false );
|
||||
|
||||
SECTION( "re-enter after failed section", "" ) {
|
||||
ctx.startCycle();
|
||||
ITracker& testCase2 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase2.isOpen() );
|
||||
|
||||
ITracker& s1b = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1b.isOpen() == false );
|
||||
|
||||
testCase2.close();
|
||||
REQUIRE( ctx.completedCycle() );
|
||||
REQUIRE( testCase.isComplete() );
|
||||
REQUIRE( testCase.isSuccessfullyCompleted() );
|
||||
}
|
||||
SECTION( "re-enter after failed section and find next section", "" ) {
|
||||
ctx.startCycle();
|
||||
ITracker& testCase2 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase2.isOpen() );
|
||||
|
||||
ITracker& s1b = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1b.isOpen() == false );
|
||||
|
||||
ITracker& s2 = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2.isOpen() );
|
||||
|
||||
s2.close();
|
||||
REQUIRE( ctx.completedCycle() );
|
||||
|
||||
testCase2.close();
|
||||
REQUIRE( testCase.isComplete() );
|
||||
REQUIRE( testCase.isSuccessfullyCompleted() );
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "successfully close one section, then find another", "" ) {
|
||||
s1.close();
|
||||
|
||||
ITracker& s2 = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2.isOpen() == false );
|
||||
|
||||
testCase.close();
|
||||
REQUIRE( testCase.isComplete() == false );
|
||||
|
||||
SECTION( "Re-enter - skips S1 and enters S2", "" ) {
|
||||
ctx.startCycle();
|
||||
ITracker& testCase2 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase2.isOpen() );
|
||||
|
||||
ITracker& s1b = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1b.isOpen() == false );
|
||||
|
||||
ITracker& s2b = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2b.isOpen() );
|
||||
|
||||
REQUIRE( ctx.completedCycle() == false );
|
||||
|
||||
SECTION ("Successfully close S2") {
|
||||
s2b.close();
|
||||
REQUIRE( ctx.completedCycle() );
|
||||
|
||||
REQUIRE( s2b.isSuccessfullyCompleted() );
|
||||
REQUIRE( testCase2.isComplete() == false );
|
||||
|
||||
testCase2.close();
|
||||
REQUIRE( testCase2.isSuccessfullyCompleted() );
|
||||
}
|
||||
SECTION ("fail S2") {
|
||||
s2b.fail();
|
||||
REQUIRE( ctx.completedCycle() );
|
||||
|
||||
REQUIRE( s2b.isComplete() );
|
||||
REQUIRE( s2b.isSuccessfullyCompleted() == false );
|
||||
|
||||
testCase2.close();
|
||||
REQUIRE( testCase2.isSuccessfullyCompleted() == false );
|
||||
|
||||
// Need a final cycle
|
||||
ctx.startCycle();
|
||||
ITracker& testCase3 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase3.isOpen() );
|
||||
|
||||
ITracker& s1c = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1c.isOpen() == false );
|
||||
|
||||
ITracker& s2c = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2c.isOpen() == false );
|
||||
|
||||
testCase3.close();
|
||||
REQUIRE( testCase3.isSuccessfullyCompleted() );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "open a nested section", "" ) {
|
||||
ITracker& s2 = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2.isOpen() );
|
||||
|
||||
s2.close();
|
||||
REQUIRE( s2.isComplete() );
|
||||
REQUIRE( s1.isComplete() == false );
|
||||
|
||||
s1.close();
|
||||
REQUIRE( s1.isComplete() );
|
||||
REQUIRE( testCase.isComplete() == false );
|
||||
|
||||
testCase.close();
|
||||
REQUIRE( testCase.isComplete() );
|
||||
}
|
||||
|
||||
SECTION( "start a generator", "" ) {
|
||||
IndexTracker& g1 = IndexTracker::acquire( ctx, "G1", 2 );
|
||||
REQUIRE( g1.isOpen() );
|
||||
REQUIRE( g1.index() == 0 );
|
||||
|
||||
REQUIRE( g1.isComplete() == false );
|
||||
REQUIRE( s1.isComplete() == false );
|
||||
|
||||
SECTION( "close outer section" )
|
||||
{
|
||||
s1.close();
|
||||
REQUIRE( s1.isComplete() == false );
|
||||
testCase.close();
|
||||
REQUIRE( testCase.isSuccessfullyCompleted() == false );
|
||||
|
||||
SECTION( "Re-enter for second generation", "" ) {
|
||||
ctx.startCycle();
|
||||
ITracker& testCase2 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase2.isOpen() );
|
||||
|
||||
ITracker& s1b = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1b.isOpen() );
|
||||
|
||||
|
||||
IndexTracker& g1b = IndexTracker::acquire( ctx, "G1", 2 );
|
||||
REQUIRE( g1b.isOpen() );
|
||||
REQUIRE( g1b.index() == 1 );
|
||||
|
||||
REQUIRE( s1.isComplete() == false );
|
||||
|
||||
s1b.close();
|
||||
REQUIRE( s1b.isComplete() );
|
||||
REQUIRE( g1b.isComplete() );
|
||||
testCase2.close();
|
||||
REQUIRE( testCase2.isComplete() );
|
||||
}
|
||||
}
|
||||
SECTION( "Start a new inner section", "" ) {
|
||||
ITracker& s2 = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2.isOpen() );
|
||||
|
||||
s2.close();
|
||||
REQUIRE( s2.isComplete() );
|
||||
|
||||
s1.close();
|
||||
REQUIRE( s1.isComplete() == false );
|
||||
|
||||
testCase.close();
|
||||
REQUIRE( testCase.isComplete() == false );
|
||||
|
||||
SECTION( "Re-enter for second generation", "" ) {
|
||||
ctx.startCycle();
|
||||
ITracker& testCase2 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase2.isOpen() );
|
||||
|
||||
ITracker& s1b = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1b.isOpen() );
|
||||
|
||||
// generator - next value
|
||||
IndexTracker& g1b = IndexTracker::acquire( ctx, "G1", 2 );
|
||||
REQUIRE( g1b.isOpen() );
|
||||
REQUIRE( g1b.index() == 1 );
|
||||
|
||||
// inner section again
|
||||
ITracker& s2b = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2b.isOpen() );
|
||||
|
||||
s2b.close();
|
||||
REQUIRE( s2b.isComplete() );
|
||||
|
||||
s1b.close();
|
||||
REQUIRE( g1b.isComplete() );
|
||||
REQUIRE( s1b.isComplete() );
|
||||
|
||||
testCase2.close();
|
||||
REQUIRE( testCase2.isComplete() );
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "Fail an inner section", "" ) {
|
||||
ITracker& s2 = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2.isOpen() );
|
||||
|
||||
s2.fail();
|
||||
REQUIRE( s2.isComplete() );
|
||||
REQUIRE( s2.isSuccessfullyCompleted() == false );
|
||||
|
||||
s1.close();
|
||||
REQUIRE( s1.isComplete() == false );
|
||||
|
||||
testCase.close();
|
||||
REQUIRE( testCase.isComplete() == false );
|
||||
|
||||
SECTION( "Re-enter for second generation", "" ) {
|
||||
ctx.startCycle();
|
||||
ITracker& testCase2 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase2.isOpen() );
|
||||
|
||||
ITracker& s1b = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1b.isOpen() );
|
||||
|
||||
// generator - still same value
|
||||
IndexTracker& g1b = IndexTracker::acquire( ctx, "G1", 2 );
|
||||
REQUIRE( g1b.isOpen() );
|
||||
REQUIRE( g1b.index() == 0 );
|
||||
|
||||
// inner section again - this time won't open
|
||||
ITracker& s2b = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2b.isOpen() == false );
|
||||
|
||||
s1b.close();
|
||||
REQUIRE( g1b.isComplete() == false );
|
||||
REQUIRE( s1b.isComplete() == false );
|
||||
|
||||
testCase2.close();
|
||||
REQUIRE( testCase2.isComplete() == false );
|
||||
|
||||
// Another cycle - now should complete
|
||||
ctx.startCycle();
|
||||
ITracker& testCase3 = SectionTracker::acquire( ctx, "Testcase" );
|
||||
REQUIRE( testCase3.isOpen() );
|
||||
|
||||
ITracker& s1c = SectionTracker::acquire( ctx, "S1" );
|
||||
REQUIRE( s1c.isOpen() );
|
||||
|
||||
// generator - now next value
|
||||
IndexTracker& g1c = IndexTracker::acquire( ctx, "G1", 2 );
|
||||
REQUIRE( g1c.isOpen() );
|
||||
REQUIRE( g1c.index() == 1 );
|
||||
|
||||
// inner section - now should open again
|
||||
ITracker& s2c = SectionTracker::acquire( ctx, "S2" );
|
||||
REQUIRE( s2c.isOpen() );
|
||||
|
||||
s2c.close();
|
||||
REQUIRE( s2c.isComplete() );
|
||||
|
||||
s1c.close();
|
||||
REQUIRE( g1c.isComplete() );
|
||||
REQUIRE( s1c.isComplete() );
|
||||
|
||||
testCase3.close();
|
||||
REQUIRE( testCase3.isComplete() );
|
||||
}
|
||||
}
|
||||
// !TBD"
|
||||
// nested generator
|
||||
// two sections within a generator
|
||||
}
|
||||
}
|
@@ -1,118 +0,0 @@
|
||||
/*
|
||||
* Created by Phil on 20/07/2013.
|
||||
* Copyright 2013 Two Blue Cubes Ltd
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
|
||||
#ifdef __clang__
|
||||
# pragma clang diagnostic ignored "-Wpadded"
|
||||
# pragma clang diagnostic ignored "-Wc++98-compat"
|
||||
#endif
|
||||
|
||||
#include "internal/catch_test_case_tracker.hpp"
|
||||
|
||||
#include "catch.hpp"
|
||||
|
||||
TEST_CASE( "section tracking", "" ) {
|
||||
|
||||
using namespace Catch;
|
||||
TestCaseTracker testCaseTracker( "test case" );
|
||||
|
||||
const std::string section1Name = "section 1";
|
||||
const std::string section2Name = "section 2";
|
||||
|
||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
||||
|
||||
SECTION( "test case with no sections", "" ) {
|
||||
|
||||
{
|
||||
TestCaseTracker::Guard guard( testCaseTracker );
|
||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
||||
}
|
||||
CHECK( testCaseTracker.isCompleted() );
|
||||
}
|
||||
|
||||
SECTION( "test case with one section", "" ) {
|
||||
|
||||
{
|
||||
TestCaseTracker::Guard guard( testCaseTracker );
|
||||
|
||||
// Enter section? - yes
|
||||
CHECK( testCaseTracker.enterSection( section1Name ) );
|
||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
||||
testCaseTracker.leaveSection();
|
||||
|
||||
// Leave test case - now complete
|
||||
}
|
||||
CHECK( testCaseTracker.isCompleted() );
|
||||
|
||||
// ...
|
||||
|
||||
// Enter test case again
|
||||
{
|
||||
TestCaseTracker::Guard guard( testCaseTracker );
|
||||
|
||||
// Enter section? - no - now complete
|
||||
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
|
||||
}
|
||||
}
|
||||
|
||||
SECTION( "test case with two consecutive sections", "" ) {
|
||||
|
||||
// Enter test case
|
||||
{
|
||||
TestCaseTracker::Guard guard( testCaseTracker );
|
||||
|
||||
// Enter section 1? - yes
|
||||
CHECK( testCaseTracker.enterSection( section1Name ) );
|
||||
testCaseTracker.leaveSection();
|
||||
|
||||
// Enter section 2? - no - we just exected section 1
|
||||
CHECK_FALSE( testCaseTracker.enterSection( section2Name ) );
|
||||
|
||||
// Leave test case - incomplete (still need to visit section 2)
|
||||
}
|
||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
||||
|
||||
// ...
|
||||
|
||||
// Enter test case again
|
||||
{
|
||||
TestCaseTracker::Guard guard( testCaseTracker );
|
||||
|
||||
// Enter section 1? - no, already done now
|
||||
CHECK_FALSE( testCaseTracker.enterSection( section1Name ) );
|
||||
|
||||
// Enter section 2? - yes
|
||||
CHECK( testCaseTracker.enterSection( section2Name ) );
|
||||
testCaseTracker.leaveSection();
|
||||
|
||||
// Leave test case - now complete
|
||||
}
|
||||
CHECK( testCaseTracker.isCompleted() );
|
||||
}
|
||||
|
||||
SECTION( "test case with one section within another", "" ) {
|
||||
|
||||
// Enter test case again
|
||||
{
|
||||
TestCaseTracker::Guard guard( testCaseTracker );
|
||||
|
||||
// Enter section 1? - yes
|
||||
CHECK( testCaseTracker.enterSection( section1Name ) );
|
||||
|
||||
// Enter section 2? - yes
|
||||
CHECK( testCaseTracker.enterSection( section2Name ) );
|
||||
|
||||
CHECK_FALSE( testCaseTracker.isCompleted() );
|
||||
|
||||
testCaseTracker.leaveSection(); // section 2
|
||||
testCaseTracker.leaveSection(); // section 1
|
||||
|
||||
// Leave test case - now complete
|
||||
}
|
||||
CHECK( testCaseTracker.isCompleted() );
|
||||
}
|
||||
}
|
@@ -1 +1,2 @@
|
||||
#include "catch_suppress_warnings.h"
|
||||
#include "catch_interfaces_exception.h"
|
||||
|
@@ -1,2 +1,3 @@
|
||||
// This file is only here to verify (to the extent possible) the self sufficiency of the header
|
||||
#include "catch_suppress_warnings.h"
|
||||
#include "catch_interfaces_registry_hub.h"
|
||||
|
@@ -1,2 +1,3 @@
|
||||
// This file is only here to verify (to the extent possible) the self sufficiency of the header
|
||||
#include "catch_suppress_warnings.h"
|
||||
#include "catch_stream.h"
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
#define CATCH_CONFIG_MAIN
|
||||
#include "catch.hpp"
|
||||
#include "reporters/catch_reporter_teamcity.hpp"
|
||||
#include "../include/reporters/catch_reporter_teamcity.hpp"
|
||||
|
||||
// Some example tag aliases
|
||||
CATCH_REGISTER_TAG_ALIAS( "[@nhf]", "[failing]~[.]" )
|
||||
@@ -53,7 +53,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
CHECK( config.shouldDebugBreak == false );
|
||||
CHECK( config.abortAfter == -1 );
|
||||
CHECK( config.noThrow == false );
|
||||
CHECK( config.reporterName.empty() );
|
||||
CHECK( config.reporterNames.empty() );
|
||||
}
|
||||
|
||||
SECTION( "test lists", "" ) {
|
||||
@@ -90,19 +90,27 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
||||
const char* argv[] = { "test", "-r", "console" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.reporterName == "console" );
|
||||
REQUIRE( config.reporterNames[0] == "console" );
|
||||
}
|
||||
SECTION( "-r/xml", "" ) {
|
||||
const char* argv[] = { "test", "-r", "xml" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.reporterName == "xml" );
|
||||
REQUIRE( config.reporterNames[0] == "xml" );
|
||||
}
|
||||
SECTION( "-r xml and junit", "" ) {
|
||||
const char* argv[] = { "test", "-r", "xml", "-r", "junit" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.reporterNames.size() == 2 );
|
||||
REQUIRE( config.reporterNames[0] == "xml" );
|
||||
REQUIRE( config.reporterNames[1] == "junit" );
|
||||
}
|
||||
SECTION( "--reporter/junit", "" ) {
|
||||
const char* argv[] = { "test", "--reporter", "junit" };
|
||||
CHECK_NOTHROW( parseIntoConfig( argv, config ) );
|
||||
|
||||
REQUIRE( config.reporterName == "junit" );
|
||||
REQUIRE( config.reporterNames[0] == "junit" );
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -7,6 +7,7 @@
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
26059AF21BD4B94C003D575C /* PartTrackerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */; };
|
||||
263F7A4719B6FCBF009474C2 /* EnumToString.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4619B6FCBF009474C2 /* EnumToString.cpp */; };
|
||||
263F7A4B19B6FE1E009474C2 /* ToStringPair.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4819B6FE1E009474C2 /* ToStringPair.cpp */; };
|
||||
263F7A4C19B6FE1E009474C2 /* ToStringVector.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 263F7A4919B6FE1E009474C2 /* ToStringVector.cpp */; };
|
||||
@@ -17,7 +18,6 @@
|
||||
26711C8F195D465C0033EDA2 /* TagAliasTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */; };
|
||||
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26847E5D16BBADB40043B9C1 /* catch_message.cpp */; };
|
||||
2691574C1A532A280054F1ED /* ToStringTuple.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2691574B1A532A280054F1ED /* ToStringTuple.cpp */; };
|
||||
26948286179A9AB900ED166E /* SectionTrackerTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26948284179A9AB900ED166E /* SectionTrackerTests.cpp */; };
|
||||
2694A1FD16A0000E004816E3 /* catch_text.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2694A1FB16A0000E004816E3 /* catch_text.cpp */; };
|
||||
26E1B7D319213BC900812682 /* CmdLineTests.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 26E1B7D119213BC900812682 /* CmdLineTests.cpp */; };
|
||||
4A45DA2416161EF9004F8D6B /* catch_console_colour.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */; };
|
||||
@@ -62,6 +62,7 @@
|
||||
/* End PBXCopyFilesBuildPhase section */
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PartTrackerTests.cpp; path = ../../../SelfTest/PartTrackerTests.cpp; sourceTree = "<group>"; };
|
||||
261488FA184C81130041FBEB /* catch_test_spec.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_spec.hpp; sourceTree = "<group>"; };
|
||||
261488FC184D1DC10041FBEB /* catch_stream.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_stream.h; sourceTree = "<group>"; };
|
||||
261488FD184D21290041FBEB /* catch_section_info.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_section_info.h; sourceTree = "<group>"; };
|
||||
@@ -100,7 +101,6 @@
|
||||
2691574B1A532A280054F1ED /* ToStringTuple.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ToStringTuple.cpp; path = ../../../SelfTest/ToStringTuple.cpp; sourceTree = "<group>"; };
|
||||
26926E8318D7777D004E10F2 /* clara.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = clara.h; path = ../../../../include/external/clara.h; sourceTree = "<group>"; };
|
||||
26926E8418D77809004E10F2 /* tbc_text_format.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = tbc_text_format.h; path = ../../../../include/external/tbc_text_format.h; sourceTree = "<group>"; };
|
||||
26948284179A9AB900ED166E /* SectionTrackerTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = SectionTrackerTests.cpp; path = ../../../SelfTest/SectionTrackerTests.cpp; sourceTree = "<group>"; };
|
||||
26948287179EF7F900ED166E /* catch_test_case_tracker.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_tracker.hpp; sourceTree = "<group>"; };
|
||||
2694A1FB16A0000E004816E3 /* catch_text.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = catch_text.cpp; sourceTree = "<group>"; };
|
||||
269831E519078C1600BB0CE0 /* catch_tostring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_tostring.h; sourceTree = "<group>"; };
|
||||
@@ -110,6 +110,7 @@
|
||||
26DACF2F17206D3400A21326 /* catch_text.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = catch_text.h; sourceTree = "<group>"; };
|
||||
26DFD3B11B53F84700FD6F16 /* catch_wildcard_pattern.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_wildcard_pattern.hpp; sourceTree = "<group>"; };
|
||||
26E1B7D119213BC900812682 /* CmdLineTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CmdLineTests.cpp; path = ../../../SelfTest/CmdLineTests.cpp; sourceTree = "<group>"; };
|
||||
26EDFBD91B72011F00B1873C /* catch_reporter_multi.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_multi.hpp; sourceTree = "<group>"; };
|
||||
4A084F1C15DACEEA0027E631 /* catch_test_case_info.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = catch_test_case_info.hpp; sourceTree = "<group>"; };
|
||||
4A3D7DD01503869D005F9203 /* catch_matchers.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_matchers.hpp; sourceTree = "<group>"; };
|
||||
4A45DA2316161EF9004F8D6B /* catch_console_colour.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = catch_console_colour.cpp; path = ../../../SelfTest/SurrogateCpps/catch_console_colour.cpp; sourceTree = "<group>"; };
|
||||
@@ -136,7 +137,7 @@
|
||||
4A6D0C34149B3D9E00DB3EAA /* MiscTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MiscTests.cpp; path = ../../../SelfTest/MiscTests.cpp; sourceTree = "<group>"; };
|
||||
4A6D0C35149B3D9E00DB3EAA /* TestMain.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TestMain.cpp; path = ../../../SelfTest/TestMain.cpp; sourceTree = "<group>"; };
|
||||
4A6D0C36149B3D9E00DB3EAA /* TrickyTests.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TrickyTests.cpp; path = ../../../SelfTest/TrickyTests.cpp; sourceTree = "<group>"; };
|
||||
4A6D0C42149B3E1500DB3EAA /* catch_runner.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = catch_runner.hpp; path = ../../../../include/catch_runner.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
4A6D0C42149B3E1500DB3EAA /* catch_session.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; name = catch_session.hpp; path = ../../../../include/catch_session.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
4A6D0C43149B3E1500DB3EAA /* catch_with_main.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch_with_main.hpp; path = ../../../../include/catch_with_main.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C44149B3E1500DB3EAA /* catch.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; name = catch.hpp; path = ../../../../include/catch.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C46149B3E3D00DB3EAA /* catch_approx.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_approx.hpp; sourceTree = "<group>"; };
|
||||
@@ -163,7 +164,7 @@
|
||||
4A6D0C5B149B3E3D00DB3EAA /* catch_reporter_registry.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_reporter_registry.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C5C149B3E3D00DB3EAA /* catch_result_type.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_result_type.h; sourceTree = "<group>"; };
|
||||
4A6D0C5D149B3E3D00DB3EAA /* catch_assertionresult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; lineEnding = 0; path = catch_assertionresult.h; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.objcpp; };
|
||||
4A6D0C5E149B3E3D00DB3EAA /* catch_runner_impl.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_runner_impl.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
4A6D0C5E149B3E3D00DB3EAA /* catch_run_context.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; lineEnding = 0; path = catch_run_context.hpp; sourceTree = "<group>"; xcLanguageSpecificationIdentifier = xcode.lang.cpp; };
|
||||
4A6D0C5F149B3E3D00DB3EAA /* catch_section.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_section.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C60149B3E3D00DB3EAA /* catch_stream.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = catch_stream.hpp; sourceTree = "<group>"; };
|
||||
4A6D0C61149B3E3D00DB3EAA /* catch_test_case_info.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = catch_test_case_info.h; sourceTree = "<group>"; };
|
||||
@@ -211,7 +212,7 @@
|
||||
266E9AD317290E710061DAB2 /* Introspective Tests */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
26948284179A9AB900ED166E /* SectionTrackerTests.cpp */,
|
||||
26059AF11BD4B94C003D575C /* PartTrackerTests.cpp */,
|
||||
26E1B7D119213BC900812682 /* CmdLineTests.cpp */,
|
||||
26711C8D195D465C0033EDA2 /* TagAliasTests.cpp */,
|
||||
);
|
||||
@@ -285,7 +286,7 @@
|
||||
4AA7B8B4165428BA003155F6 /* catch_version.hpp */,
|
||||
4A8E4DCF160A34E200194CBD /* SurrogateCpps */,
|
||||
4A6D0C44149B3E1500DB3EAA /* catch.hpp */,
|
||||
4A6D0C42149B3E1500DB3EAA /* catch_runner.hpp */,
|
||||
4A6D0C42149B3E1500DB3EAA /* catch_session.hpp */,
|
||||
4A6D0C43149B3E1500DB3EAA /* catch_with_main.hpp */,
|
||||
4A6D0C45149B3E3D00DB3EAA /* internal */,
|
||||
4A6D0C65149B3E3D00DB3EAA /* reporters */,
|
||||
@@ -318,6 +319,7 @@
|
||||
4A6D0C68149B3E3D00DB3EAA /* catch_reporter_xml.hpp */,
|
||||
4AB42F84166F3E1A0099F2C8 /* catch_reporter_console.hpp */,
|
||||
2691574A1A4480C50054F1ED /* catch_reporter_teamcity.hpp */,
|
||||
26EDFBD91B72011F00B1873C /* catch_reporter_multi.hpp */,
|
||||
);
|
||||
name = reporters;
|
||||
path = ../../../../include/reporters;
|
||||
@@ -358,7 +360,7 @@
|
||||
4A4B0F9715CE6CFB00AE2392 /* catch_registry_hub.hpp */,
|
||||
4A6D0C50149B3E3D00DB3EAA /* catch_generators_impl.hpp */,
|
||||
4A6D0C52149B3E3D00DB3EAA /* catch_context_impl.hpp */,
|
||||
4A6D0C5E149B3E3D00DB3EAA /* catch_runner_impl.hpp */,
|
||||
4A6D0C5E149B3E3D00DB3EAA /* catch_run_context.hpp */,
|
||||
4A6D0C62149B3E3D00DB3EAA /* catch_test_case_registry_impl.hpp */,
|
||||
4AB1C73514F97BDA00F31DF7 /* catch_console_colour_impl.hpp */,
|
||||
4A4B0F9B15CEF8C400AE2392 /* catch_notimplemented_exception.hpp */,
|
||||
@@ -546,6 +548,7 @@
|
||||
4A6D0C3E149B3D9E00DB3EAA /* TestMain.cpp in Sources */,
|
||||
4A6D0C3F149B3D9E00DB3EAA /* TrickyTests.cpp in Sources */,
|
||||
263F7A4D19B6FE1E009474C2 /* ToStringWhich.cpp in Sources */,
|
||||
26059AF21BD4B94C003D575C /* PartTrackerTests.cpp in Sources */,
|
||||
263F7A4B19B6FE1E009474C2 /* ToStringPair.cpp in Sources */,
|
||||
4AEE032016142F910071E950 /* catch_common.cpp in Sources */,
|
||||
263F7A4C19B6FE1E009474C2 /* ToStringVector.cpp in Sources */,
|
||||
@@ -572,7 +575,6 @@
|
||||
26847E5F16BBADB40043B9C1 /* catch_message.cpp in Sources */,
|
||||
266B06B816F3A60A004ED264 /* VariadicMacrosTests.cpp in Sources */,
|
||||
266ECD74170F3C620030D735 /* BDDTests.cpp in Sources */,
|
||||
26948286179A9AB900ED166E /* SectionTrackerTests.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@@ -10,31 +10,31 @@
|
||||
<string>CatchSelfTestSingle</string>
|
||||
<key>IDESourceControlProjectOriginsDictionary</key>
|
||||
<dict>
|
||||
<key>01DD8CA9-7DC3-46BC-B998-EFF40EA3485F</key>
|
||||
<string>ssh://github.com/philsquared/Catch.git</string>
|
||||
<key>90C00904F36E6ADB57A7313E998815D255B0DEAF</key>
|
||||
<string>https://github.com/philsquared/Catch.git</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectPath</key>
|
||||
<string>projects/XCode4/CatchSelfTest/CatchSelfTestSingle.xcodeproj/project.xcworkspace</string>
|
||||
<string>projects/XCode/CatchSelfTest/CatchSelfTestSingle.xcodeproj</string>
|
||||
<key>IDESourceControlProjectRelativeInstallPathDictionary</key>
|
||||
<dict>
|
||||
<key>01DD8CA9-7DC3-46BC-B998-EFF40EA3485F</key>
|
||||
<key>90C00904F36E6ADB57A7313E998815D255B0DEAF</key>
|
||||
<string>../../../../..</string>
|
||||
</dict>
|
||||
<key>IDESourceControlProjectURL</key>
|
||||
<string>ssh://github.com/philsquared/Catch.git</string>
|
||||
<string>https://github.com/philsquared/Catch.git</string>
|
||||
<key>IDESourceControlProjectVersion</key>
|
||||
<integer>110</integer>
|
||||
<integer>111</integer>
|
||||
<key>IDESourceControlProjectWCCIdentifier</key>
|
||||
<string>01DD8CA9-7DC3-46BC-B998-EFF40EA3485F</string>
|
||||
<string>90C00904F36E6ADB57A7313E998815D255B0DEAF</string>
|
||||
<key>IDESourceControlProjectWCConfigurations</key>
|
||||
<array>
|
||||
<dict>
|
||||
<key>IDESourceControlRepositoryExtensionIdentifierKey</key>
|
||||
<string>public.vcs.git</string>
|
||||
<key>IDESourceControlWCCIdentifierKey</key>
|
||||
<string>01DD8CA9-7DC3-46BC-B998-EFF40EA3485F</string>
|
||||
<string>90C00904F36E6ADB57A7313E998815D255B0DEAF</string>
|
||||
<key>IDESourceControlWCCName</key>
|
||||
<string>Catch</string>
|
||||
<string>Catch-Develop</string>
|
||||
</dict>
|
||||
</array>
|
||||
</dict>
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user