mirror of
https://github.com/catchorg/Catch2.git
synced 2025-02-16 19:43:28 +01:00
Builds almost completely cleanly with -WEverything in LLVM
This commit is contained in:
parent
cdc64a138b
commit
a695eb9006
@ -9,6 +9,12 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wno-global-constructors"
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
|
|
||||||
#include "internal/catch_notimplemented_exception.h"
|
#include "internal/catch_notimplemented_exception.h"
|
||||||
#include "internal/catch_context.h"
|
#include "internal/catch_context.h"
|
||||||
#include "internal/catch_test_registry.hpp"
|
#include "internal/catch_test_registry.hpp"
|
||||||
@ -29,7 +35,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER )
|
#if defined( CATCH_CONFIG_MAIN ) || defined( CATCH_CONFIG_RUNNER )
|
||||||
#include "catch_runner.hpp"
|
|
||||||
#include "internal/catch_impl.hpp"
|
#include "internal/catch_impl.hpp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -127,4 +132,6 @@
|
|||||||
|
|
||||||
using Catch::Detail::Approx;
|
using Catch::Detail::Approx;
|
||||||
|
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_HPP_INCLUDED
|
||||||
|
@ -8,12 +8,14 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_RUNNER_HPP_INCLUDED
|
||||||
|
|
||||||
#include "internal/catch_commandline.hpp"
|
|
||||||
#include "internal/catch_list.hpp"
|
|
||||||
#include "reporters/catch_reporter_basic.hpp"
|
#include "reporters/catch_reporter_basic.hpp"
|
||||||
#include "reporters/catch_reporter_xml.hpp"
|
#include "reporters/catch_reporter_xml.hpp"
|
||||||
#include "reporters/catch_reporter_junit.hpp"
|
#include "reporters/catch_reporter_junit.hpp"
|
||||||
|
|
||||||
|
#include "internal/catch_commandline.hpp"
|
||||||
|
#include "internal/catch_list.hpp"
|
||||||
|
#include "internal/catch_runner_impl.hpp"
|
||||||
|
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/*
|
/*
|
||||||
* Created by Phil on 01/11/2010.
|
* Created by Phil on 01/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
|
@ -9,7 +9,6 @@
|
|||||||
#define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_COMMANDLINE_HPP_INCLUDED
|
||||||
|
|
||||||
#include "catch_config.hpp"
|
#include "catch_config.hpp"
|
||||||
#include "catch_runner_impl.hpp"
|
|
||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
@ -42,7 +41,8 @@ namespace Catch {
|
|||||||
std::string name() const { return m_name; }
|
std::string name() const { return m_name; }
|
||||||
std::string operator[]( std::size_t i ) const { return m_args[i]; }
|
std::string operator[]( std::size_t i ) const { return m_args[i]; }
|
||||||
std::size_t argsCount() const { return m_args.size(); }
|
std::size_t argsCount() const { return m_args.size(); }
|
||||||
|
|
||||||
|
CATCH_ATTRIBUTE_NORETURN
|
||||||
void raiseError( const std::string& message ) const {
|
void raiseError( const std::string& message ) const {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Error while parsing " << m_name << ". " << message << ".";
|
oss << "Error while parsing " << m_name << ". " << message << ".";
|
||||||
|
@ -16,9 +16,9 @@
|
|||||||
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
|
#define INTERNAL_CATCH_STRINGIFY( expr ) INTERNAL_CATCH_STRINGIFY2( expr )
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#define ATTRIBUTE_NORETURN __attribute__ ((noreturn))
|
#define CATCH_ATTRIBUTE_NORETURN __attribute__ ((noreturn))
|
||||||
#else
|
#else
|
||||||
#define ATTRIBUTE_NORETURN
|
#define CATCH_ATTRIBUTE_NORETURN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
void operator = ( const NonCopyable& );
|
void operator = ( const NonCopyable& );
|
||||||
protected:
|
protected:
|
||||||
NonCopyable() {}
|
NonCopyable() {}
|
||||||
virtual ~NonCopyable() {}
|
virtual ~NonCopyable();
|
||||||
};
|
};
|
||||||
|
|
||||||
class SafeBool {
|
class SafeBool {
|
||||||
@ -110,21 +110,16 @@ namespace Catch {
|
|||||||
return os;
|
return os;
|
||||||
}
|
}
|
||||||
|
|
||||||
ATTRIBUTE_NORETURN
|
CATCH_ATTRIBUTE_NORETURN
|
||||||
inline void throwLogicError( const std::string& message, const std::string& file, std::size_t line ) {
|
inline void throwLogicError( const std::string& message, const SourceLineInfo& locationInfo ) {
|
||||||
std::ostringstream oss;
|
std::ostringstream oss;
|
||||||
oss << "Internal Catch error: '" << message << "' at: " << SourceLineInfo( file, line );
|
oss << "Internal Catch error: '" << message << "' at: " << locationInfo;
|
||||||
throw std::logic_error( oss.str() );
|
throw std::logic_error( oss.str() );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#define CATCH_INTERNAL_ERROR( msg ) throwLogicError( msg, __FILE__, __LINE__ );
|
#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, static_cast<std::size_t>( __LINE__ ) )
|
||||||
|
#define CATCH_INTERNAL_ERROR( msg ) ::Catch::throwLogicError( msg, CATCH_INTERNAL_LINEINFO );
|
||||||
//#ifdef __FUNCTION__
|
|
||||||
//#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FUNCTION__, __FILE__, __LINE__ )
|
|
||||||
//#else
|
|
||||||
#define CATCH_INTERNAL_LINEINFO ::Catch::SourceLineInfo( __FILE__, __LINE__ )
|
|
||||||
//#endif
|
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_COMMON_H_INCLUDED
|
||||||
|
|
||||||
|
@ -64,8 +64,9 @@ namespace Catch {
|
|||||||
private:
|
private:
|
||||||
Config( const Config& other );
|
Config( const Config& other );
|
||||||
Config& operator = ( const Config& other );
|
Config& operator = ( const Config& other );
|
||||||
|
virtual void dummy();
|
||||||
public:
|
public:
|
||||||
|
|
||||||
Config()
|
Config()
|
||||||
: m_streambuf( NULL ),
|
: m_streambuf( NULL ),
|
||||||
m_os( std::cout.rdbuf() )
|
m_os( std::cout.rdbuf() )
|
||||||
@ -77,7 +78,7 @@ namespace Catch {
|
|||||||
m_os( std::cout.rdbuf() )
|
m_os( std::cout.rdbuf() )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
~Config() {
|
virtual ~Config() {
|
||||||
m_os.rdbuf( std::cout.rdbuf() );
|
m_os.rdbuf( std::cout.rdbuf() );
|
||||||
delete m_streambuf;
|
delete m_streambuf;
|
||||||
}
|
}
|
||||||
|
@ -23,11 +23,14 @@ namespace Catch {
|
|||||||
struct IRunner;
|
struct IRunner;
|
||||||
struct IGeneratorsForTest;
|
struct IGeneratorsForTest;
|
||||||
|
|
||||||
class StreamBufBase : public std::streambuf{};
|
class StreamBufBase : public std::streambuf {
|
||||||
|
public:
|
||||||
|
virtual ~StreamBufBase();
|
||||||
|
};
|
||||||
|
|
||||||
struct IContext
|
struct IContext
|
||||||
{
|
{
|
||||||
virtual ~IContext(){}
|
virtual ~IContext();
|
||||||
|
|
||||||
virtual IResultCapture& getResultCapture() = 0;
|
virtual IResultCapture& getResultCapture() = 0;
|
||||||
virtual IRunner& getRunner() = 0;
|
virtual IRunner& getRunner() = 0;
|
||||||
@ -38,6 +41,7 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IMutableContext : IContext
|
struct IMutableContext : IContext
|
||||||
{
|
{
|
||||||
|
virtual ~IMutableContext();
|
||||||
virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
|
virtual void setResultCapture( IResultCapture* resultCapture ) = 0;
|
||||||
virtual void setRunner( IRunner* runner ) = 0;
|
virtual void setRunner( IRunner* runner ) = 0;
|
||||||
virtual void setConfig( const IConfig* config ) = 0;
|
virtual void setConfig( const IConfig* config ) = 0;
|
||||||
|
@ -8,6 +8,11 @@
|
|||||||
|
|
||||||
// Collect all the implementation files together here
|
// Collect all the implementation files together here
|
||||||
// These are the equivalent of what would usually be cpp files
|
// These are the equivalent of what would usually be cpp files
|
||||||
|
|
||||||
|
#pragma clang diagnostic push
|
||||||
|
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
|
|
||||||
|
#include "catch_runner.hpp"
|
||||||
#include "catch_registry_hub.hpp"
|
#include "catch_registry_hub.hpp"
|
||||||
#include "catch_notimplemented_exception.hpp"
|
#include "catch_notimplemented_exception.hpp"
|
||||||
#include "catch_context_impl.hpp"
|
#include "catch_context_impl.hpp"
|
||||||
@ -15,3 +20,35 @@
|
|||||||
#include "catch_generators_impl.hpp"
|
#include "catch_generators_impl.hpp"
|
||||||
#include "catch_resultinfo.hpp"
|
#include "catch_resultinfo.hpp"
|
||||||
#include "catch_resultinfo_builder.hpp"
|
#include "catch_resultinfo_builder.hpp"
|
||||||
|
|
||||||
|
namespace Catch {
|
||||||
|
NonCopyable::~NonCopyable() {}
|
||||||
|
IShared::~IShared() {}
|
||||||
|
StreamBufBase::~StreamBufBase() {}
|
||||||
|
IContext::~IContext() {}
|
||||||
|
IResultCapture::~IResultCapture() {}
|
||||||
|
ITestCase::~ITestCase() {}
|
||||||
|
ITestCaseRegistry::~ITestCaseRegistry() {}
|
||||||
|
IRegistryHub::~IRegistryHub() {}
|
||||||
|
IMutableRegistryHub::~IMutableRegistryHub() {}
|
||||||
|
IExceptionTranslator::~IExceptionTranslator() {}
|
||||||
|
IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() {}
|
||||||
|
IReporter::~IReporter() {}
|
||||||
|
IReporterFactory::~IReporterFactory() {}
|
||||||
|
IReporterRegistry::~IReporterRegistry() {}
|
||||||
|
BasicReporter::~BasicReporter() {}
|
||||||
|
IRunner::~IRunner() {}
|
||||||
|
IMutableContext::~IMutableContext() {}
|
||||||
|
IConfig::~IConfig() {}
|
||||||
|
XmlReporter::~XmlReporter() {}
|
||||||
|
JunitReporter::~JunitReporter() {}
|
||||||
|
TestRegistry::~TestRegistry() {}
|
||||||
|
FreeFunctionTestCase::~FreeFunctionTestCase() {}
|
||||||
|
IGeneratorInfo::~IGeneratorInfo() {}
|
||||||
|
IGeneratorsForTest::~IGeneratorsForTest() {}
|
||||||
|
|
||||||
|
void Config::dummy() {}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic pop
|
||||||
|
@ -21,7 +21,7 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IResultCapture {
|
struct IResultCapture {
|
||||||
|
|
||||||
virtual ~IResultCapture(){}
|
virtual ~IResultCapture();
|
||||||
|
|
||||||
virtual void testEnded( const ResultInfo& result ) = 0;
|
virtual void testEnded( const ResultInfo& result ) = 0;
|
||||||
virtual bool sectionStarted( const std::string& name,
|
virtual bool sectionStarted( const std::string& name,
|
||||||
|
@ -12,7 +12,7 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IConfig {
|
struct IConfig {
|
||||||
|
|
||||||
virtual ~IConfig(){}
|
virtual ~IConfig();
|
||||||
|
|
||||||
virtual bool allowThrows() const = 0;
|
virtual bool allowThrows() const = 0;
|
||||||
};
|
};
|
||||||
|
@ -16,12 +16,12 @@ namespace Catch {
|
|||||||
typedef std::string(*exceptionTranslateFunction)();
|
typedef std::string(*exceptionTranslateFunction)();
|
||||||
|
|
||||||
struct IExceptionTranslator {
|
struct IExceptionTranslator {
|
||||||
virtual ~IExceptionTranslator(){}
|
virtual ~IExceptionTranslator();
|
||||||
virtual std::string translate() const = 0;
|
virtual std::string translate() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IExceptionTranslatorRegistry {
|
struct IExceptionTranslatorRegistry {
|
||||||
virtual ~IExceptionTranslatorRegistry(){}
|
virtual ~IExceptionTranslatorRegistry();
|
||||||
|
|
||||||
virtual std::string translateActiveException() const = 0;
|
virtual std::string translateActiveException() const = 0;
|
||||||
};
|
};
|
||||||
|
@ -13,13 +13,13 @@
|
|||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
struct IGeneratorInfo {
|
struct IGeneratorInfo {
|
||||||
virtual ~IGeneratorInfo(){}
|
virtual ~IGeneratorInfo();
|
||||||
virtual bool moveNext() = 0;
|
virtual bool moveNext() = 0;
|
||||||
virtual std::size_t getCurrentIndex() const = 0;
|
virtual std::size_t getCurrentIndex() const = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct IGeneratorsForTest {
|
struct IGeneratorsForTest {
|
||||||
virtual ~IGeneratorsForTest() {}
|
virtual ~IGeneratorsForTest();
|
||||||
|
|
||||||
virtual IGeneratorInfo& getGeneratorInfo( const std::string& fileInfo, std::size_t size ) = 0;
|
virtual IGeneratorInfo& getGeneratorInfo( const std::string& fileInfo, std::size_t size ) = 0;
|
||||||
virtual bool moveNext() = 0;
|
virtual bool moveNext() = 0;
|
||||||
|
@ -24,7 +24,7 @@ namespace Catch {
|
|||||||
struct IExceptionTranslator;
|
struct IExceptionTranslator;
|
||||||
|
|
||||||
struct IRegistryHub {
|
struct IRegistryHub {
|
||||||
virtual ~IRegistryHub(){}
|
virtual ~IRegistryHub();
|
||||||
|
|
||||||
virtual const IReporterRegistry& getReporterRegistry() const = 0;
|
virtual const IReporterRegistry& getReporterRegistry() const = 0;
|
||||||
virtual const ITestCaseRegistry& getTestCaseRegistry() const = 0;
|
virtual const ITestCaseRegistry& getTestCaseRegistry() const = 0;
|
||||||
@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct IMutableRegistryHub {
|
struct IMutableRegistryHub {
|
||||||
virtual ~IMutableRegistryHub(){}
|
virtual ~IMutableRegistryHub();
|
||||||
virtual void registerReporter( const std::string& name, IReporterFactory* factory ) = 0;
|
virtual void registerReporter( const std::string& name, IReporterFactory* factory ) = 0;
|
||||||
virtual void registerTest( const TestCaseInfo& testInfo ) = 0;
|
virtual void registerTest( const TestCaseInfo& testInfo ) = 0;
|
||||||
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
||||||
|
@ -37,7 +37,7 @@ namespace Catch
|
|||||||
class ResultInfo;
|
class ResultInfo;
|
||||||
|
|
||||||
struct IReporter : IShared {
|
struct IReporter : IShared {
|
||||||
virtual ~IReporter() {}
|
virtual ~IReporter();
|
||||||
virtual bool shouldRedirectStdout() const = 0;
|
virtual bool shouldRedirectStdout() const = 0;
|
||||||
virtual void StartTesting() = 0;
|
virtual void StartTesting() = 0;
|
||||||
virtual void EndTesting( const Totals& totals ) = 0;
|
virtual void EndTesting( const Totals& totals ) = 0;
|
||||||
@ -52,7 +52,7 @@ namespace Catch
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct IReporterFactory {
|
struct IReporterFactory {
|
||||||
virtual ~IReporterFactory() {}
|
virtual ~IReporterFactory();
|
||||||
virtual IReporter* create( const ReporterConfig& config ) const = 0;
|
virtual IReporter* create( const ReporterConfig& config ) const = 0;
|
||||||
virtual std::string getDescription() const = 0;
|
virtual std::string getDescription() const = 0;
|
||||||
};
|
};
|
||||||
@ -60,7 +60,7 @@ namespace Catch
|
|||||||
struct IReporterRegistry {
|
struct IReporterRegistry {
|
||||||
typedef std::map<std::string, IReporterFactory*> FactoryMap;
|
typedef std::map<std::string, IReporterFactory*> FactoryMap;
|
||||||
|
|
||||||
virtual ~IReporterRegistry() {}
|
virtual ~IReporterRegistry();
|
||||||
virtual IReporter* create( const std::string& name, const ReporterConfig& config ) const = 0;
|
virtual IReporter* create( const std::string& name, const ReporterConfig& config ) const = 0;
|
||||||
virtual const FactoryMap& getFactories() const = 0;
|
virtual const FactoryMap& getFactories() const = 0;
|
||||||
};
|
};
|
||||||
|
@ -16,7 +16,7 @@ namespace Catch {
|
|||||||
class TestCaseInfo;
|
class TestCaseInfo;
|
||||||
|
|
||||||
struct IRunner {
|
struct IRunner {
|
||||||
virtual ~IRunner() {}
|
virtual ~IRunner();
|
||||||
virtual void runAll( bool runHiddenTests = false ) = 0;
|
virtual void runAll( bool runHiddenTests = false ) = 0;
|
||||||
virtual std::size_t runMatching( const std::string& rawTestSpec ) = 0;
|
virtual std::size_t runMatching( const std::string& rawTestSpec ) = 0;
|
||||||
virtual Totals getTotals() const = 0;
|
virtual Totals getTotals() const = 0;
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
struct ITestCase {
|
struct ITestCase {
|
||||||
virtual ~ITestCase(){}
|
virtual ~ITestCase();
|
||||||
virtual void invoke () const = 0;
|
virtual void invoke () const = 0;
|
||||||
virtual ITestCase* clone() const = 0;
|
virtual ITestCase* clone() const = 0;
|
||||||
virtual bool operator == ( const ITestCase& other ) const = 0;
|
virtual bool operator == ( const ITestCase& other ) const = 0;
|
||||||
@ -22,7 +22,7 @@ namespace Catch {
|
|||||||
class TestCaseInfo;
|
class TestCaseInfo;
|
||||||
|
|
||||||
struct ITestCaseRegistry {
|
struct ITestCaseRegistry {
|
||||||
virtual ~ITestCaseRegistry(){}
|
virtual ~ITestCaseRegistry();
|
||||||
virtual const std::vector<TestCaseInfo>& getAllTests() const = 0;
|
virtual const std::vector<TestCaseInfo>& getAllTests() const = 0;
|
||||||
virtual std::vector<TestCaseInfo> getMatchingTestCases( const std::string& rawTestSpec ) const = 0;
|
virtual std::vector<TestCaseInfo> getMatchingTestCases( const std::string& rawTestSpec ) const = 0;
|
||||||
};
|
};
|
||||||
|
@ -74,7 +74,7 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct IShared : NonCopyable {
|
struct IShared : NonCopyable {
|
||||||
virtual ~IShared(){}
|
virtual ~IShared();
|
||||||
virtual void addRef() = 0;
|
virtual void addRef() = 0;
|
||||||
virtual void release() = 0;
|
virtual void release() = 0;
|
||||||
};
|
};
|
||||||
|
@ -18,7 +18,7 @@ namespace Catch {
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
~ReporterRegistry() {
|
virtual ~ReporterRegistry() {
|
||||||
deleteAllValues( m_factories );
|
deleteAllValues( m_factories );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,7 +22,7 @@ namespace Catch {
|
|||||||
const SourceLineInfo& lineInfo,
|
const SourceLineInfo& lineInfo,
|
||||||
const char* macroName,
|
const char* macroName,
|
||||||
const char* message );
|
const char* message );
|
||||||
virtual ~ResultInfo();
|
~ResultInfo();
|
||||||
|
|
||||||
bool ok() const;
|
bool ok() const;
|
||||||
ResultWas::OfType getResultType() const;
|
ResultWas::OfType getResultType() const;
|
||||||
|
@ -70,7 +70,7 @@ namespace Catch {
|
|||||||
m_reporter->StartTesting();
|
m_reporter->StartTesting();
|
||||||
}
|
}
|
||||||
|
|
||||||
~Runner() {
|
virtual ~Runner() {
|
||||||
m_reporter->EndTesting( m_totals );
|
m_reporter->EndTesting( m_totals );
|
||||||
m_context.setRunner( m_prevRunner );
|
m_context.setRunner( m_prevRunner );
|
||||||
m_context.setConfig( NULL );
|
m_context.setConfig( NULL );
|
||||||
|
@ -19,6 +19,7 @@ namespace Catch {
|
|||||||
class TestRegistry : public ITestCaseRegistry {
|
class TestRegistry : public ITestCaseRegistry {
|
||||||
public:
|
public:
|
||||||
TestRegistry() : m_unnamedCount( 0 ) {}
|
TestRegistry() : m_unnamedCount( 0 ) {}
|
||||||
|
virtual ~TestRegistry();
|
||||||
|
|
||||||
virtual void registerTest( const TestCaseInfo& testInfo ) {
|
virtual void registerTest( const TestCaseInfo& testInfo ) {
|
||||||
if( testInfo.getName() == "" ) {
|
if( testInfo.getName() == "" ) {
|
||||||
@ -71,6 +72,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
FreeFunctionTestCase( TestFunction fun ) : m_fun( fun ) {}
|
FreeFunctionTestCase( TestFunction fun ) : m_fun( fun ) {}
|
||||||
|
virtual ~FreeFunctionTestCase();
|
||||||
|
|
||||||
virtual void invoke() const {
|
virtual void invoke() const {
|
||||||
m_fun();
|
m_fun();
|
||||||
|
@ -81,7 +81,7 @@ private:
|
|||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
#define INTERNAL_CATCH_TESTCASE_NORETURN( Name, Desc ) \
|
#define INTERNAL_CATCH_TESTCASE_NORETURN( Name, Desc ) \
|
||||||
static void INTERNAL_CATCH_UNIQUE_NAME( TestCaseFunction_catch_internal_ )() ATTRIBUTE_NORETURN; \
|
static void INTERNAL_CATCH_UNIQUE_NAME( TestCaseFunction_catch_internal_ )() CATCH_ATTRIBUTE_NORETURN; \
|
||||||
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( TestCaseFunction_catch_internal_ ), Name, Desc, CATCH_INTERNAL_LINEINFO ); }\
|
namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( &INTERNAL_CATCH_UNIQUE_NAME( TestCaseFunction_catch_internal_ ), Name, Desc, CATCH_INTERNAL_LINEINFO ); }\
|
||||||
static void INTERNAL_CATCH_UNIQUE_NAME( TestCaseFunction_catch_internal_ )()
|
static void INTERNAL_CATCH_UNIQUE_NAME( TestCaseFunction_catch_internal_ )()
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@ namespace Catch {
|
|||||||
class BasicReporter : public SharedImpl<IReporter> {
|
class BasicReporter : public SharedImpl<IReporter> {
|
||||||
|
|
||||||
struct SpanInfo {
|
struct SpanInfo {
|
||||||
|
|
||||||
SpanInfo()
|
SpanInfo()
|
||||||
: emitted( false )
|
: emitted( false )
|
||||||
{}
|
{}
|
||||||
@ -60,6 +60,8 @@ namespace Catch {
|
|||||||
m_firstSectionInTestCase( true ),
|
m_firstSectionInTestCase( true ),
|
||||||
m_aborted( false )
|
m_aborted( false )
|
||||||
{}
|
{}
|
||||||
|
|
||||||
|
virtual ~BasicReporter();
|
||||||
|
|
||||||
static std::string getDescription() {
|
static std::string getDescription() {
|
||||||
return "Reports test results as lines of text";
|
return "Reports test results as lines of text";
|
||||||
@ -222,7 +224,6 @@ namespace Catch {
|
|||||||
case ResultWas::FailureBit:
|
case ResultWas::FailureBit:
|
||||||
case ResultWas::ExpressionFailed:
|
case ResultWas::ExpressionFailed:
|
||||||
case ResultWas::Exception:
|
case ResultWas::Exception:
|
||||||
default:
|
|
||||||
if( !resultInfo.hasExpression() ) {
|
if( !resultInfo.hasExpression() ) {
|
||||||
if( resultInfo.ok() ) {
|
if( resultInfo.ok() ) {
|
||||||
TextColour colour( TextColour::Success );
|
TextColour colour( TextColour::Success );
|
||||||
|
@ -61,7 +61,8 @@ namespace Catch {
|
|||||||
: m_config( config ),
|
: m_config( config ),
|
||||||
m_testSuiteStats( "AllTests" ),
|
m_testSuiteStats( "AllTests" ),
|
||||||
m_currentStats( &m_testSuiteStats )
|
m_currentStats( &m_testSuiteStats )
|
||||||
{}
|
{}
|
||||||
|
virtual ~JunitReporter();
|
||||||
|
|
||||||
static std::string getDescription() {
|
static std::string getDescription() {
|
||||||
return "Reports test results in an XML format that looks like Ant's junitreport target";
|
return "Reports test results in an XML format that looks like Ant's junitreport target";
|
||||||
@ -131,8 +132,6 @@ namespace Catch {
|
|||||||
case ResultWas::FailureBit:
|
case ResultWas::FailureBit:
|
||||||
case ResultWas::Exception:
|
case ResultWas::Exception:
|
||||||
case ResultWas::DidntThrowException:
|
case ResultWas::DidntThrowException:
|
||||||
default:
|
|
||||||
stats.m_element = "unknown";
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
testCaseStats.m_testStats.push_back( stats );
|
testCaseStats.m_testStats.push_back( stats );
|
||||||
|
@ -21,6 +21,7 @@ namespace Catch {
|
|||||||
static std::string getDescription() {
|
static std::string getDescription() {
|
||||||
return "Reports test results as an XML document";
|
return "Reports test results as an XML document";
|
||||||
}
|
}
|
||||||
|
virtual ~XmlReporter();
|
||||||
|
|
||||||
private: // IReporter
|
private: // IReporter
|
||||||
|
|
||||||
@ -116,7 +117,6 @@ namespace Catch {
|
|||||||
case ResultWas::ExpressionFailed:
|
case ResultWas::ExpressionFailed:
|
||||||
case ResultWas::Exception:
|
case ResultWas::Exception:
|
||||||
case ResultWas::DidntThrowException:
|
case ResultWas::DidntThrowException:
|
||||||
default:
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if( resultInfo.hasExpression() )
|
if( resultInfo.hasExpression() )
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* ApproxTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 28/04/2011.
|
* Created by Phil on 28/04/2011.
|
||||||
* Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* ClassTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 09/11/2010.
|
* Created by Phil on 09/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* ConditionTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 08/11/2010.
|
* Created by Phil on 08/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* ExceptionTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 09/11/2010.
|
* Created by Phil on 09/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -19,7 +17,7 @@
|
|||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
ATTRIBUTE_NORETURN
|
CATCH_ATTRIBUTE_NORETURN
|
||||||
int thisThrows();
|
int thisThrows();
|
||||||
|
|
||||||
int thisThrows()
|
int thisThrows()
|
||||||
@ -41,6 +39,7 @@ TEST_CASE( "./succeeding/exceptions/explicit", "When checked exceptions are thro
|
|||||||
REQUIRE_THROWS( thisThrows() );
|
REQUIRE_THROWS( thisThrows() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CATCH_ATTRIBUTE_NORETURN
|
||||||
TEST_CASE( "./failing/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" )
|
TEST_CASE( "./failing/exceptions/explicit", "When checked exceptions are thrown they can be expected or unexpected" )
|
||||||
{
|
{
|
||||||
CHECK_THROWS_AS( thisThrows(), std::string );
|
CHECK_THROWS_AS( thisThrows(), std::string );
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* GeneratorTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 28/01/2011.
|
* Created by Phil on 28/01/2011.
|
||||||
* Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2011 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// This define means we have to prefix all the CATCH macros with CATCH_
|
// This define means we have to prefix all the CATCH macros with CATCH_
|
||||||
|
@ -1,13 +1,9 @@
|
|||||||
/*
|
/*
|
||||||
* MessageTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 09/11/2010.
|
* Created by Phil on 09/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
@ -1,14 +1,11 @@
|
|||||||
/*
|
/*
|
||||||
* MiscTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 29/11/2010.
|
* Created by Phil on 29/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
#include "catch_self_test.hpp"
|
#include "catch_self_test.hpp"
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*/
|
*/
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
#include "catch_self_test.hpp"
|
#include "catch_self_test.hpp"
|
||||||
|
|
||||||
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" ) {
|
TEST_CASE( "selftest/main", "Runs all Catch self tests and checks their results" ) {
|
||||||
@ -54,6 +56,8 @@ TEST_CASE( "meta/Misc/Sections", "looped tests" ) {
|
|||||||
CHECK( runner.getTotals().assertions.failed == 1 );
|
CHECK( runner.getTotals().assertions.failed == 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wweak-vtables"
|
||||||
|
|
||||||
#include "../../include/internal/catch_commandline.hpp"
|
#include "../../include/internal/catch_commandline.hpp"
|
||||||
#include "../../include/reporters/catch_reporter_basic.hpp"
|
#include "../../include/reporters/catch_reporter_basic.hpp"
|
||||||
#include "../../include/reporters/catch_reporter_xml.hpp"
|
#include "../../include/reporters/catch_reporter_xml.hpp"
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* TrickyTests.cpp
|
|
||||||
* Catch - Test
|
|
||||||
*
|
|
||||||
* Created by Phil on 09/11/2010.
|
* Created by Phil on 09/11/2010.
|
||||||
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
#include "catch.hpp"
|
#include "catch.hpp"
|
||||||
|
|
||||||
namespace Catch
|
namespace Catch
|
||||||
|
@ -1,15 +1,13 @@
|
|||||||
/*
|
/*
|
||||||
* catch_self_test.cpp
|
|
||||||
* Catch
|
|
||||||
*
|
|
||||||
* Created by Phil on 14/02/2012.
|
* Created by Phil on 14/02/2012.
|
||||||
* Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
|
* Copyright 2012 Two Blue Cubes Ltd. All rights reserved.
|
||||||
*
|
*
|
||||||
* Distributed under the Boost Software License, Version 1.0. (See accompanying
|
* 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)
|
* file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#pragma clang diagnostic ignored "-Wpadded"
|
||||||
|
|
||||||
#define CATCH_CONFIG_MAIN
|
#define CATCH_CONFIG_MAIN
|
||||||
#include "catch_self_test.hpp"
|
#include "catch_self_test.hpp"
|
||||||
|
|
||||||
@ -69,9 +67,6 @@ namespace Catch{
|
|||||||
case ResultWas::Exception:
|
case ResultWas::Exception:
|
||||||
m_log << "Exception";
|
m_log << "Exception";
|
||||||
break;
|
break;
|
||||||
default:
|
|
||||||
m_log << "{unrecognised ResultType enum value}";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( resultInfo.hasExpression() )
|
if( resultInfo.hasExpression() )
|
||||||
|
@ -465,14 +465,28 @@
|
|||||||
4A6D0C2B149B3D3B00DB3EAA /* Debug */ = {
|
4A6D0C2B149B3D3B00DB3EAA /* Debug */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
WARNING_CFLAGS = (
|
||||||
|
"-Weverything",
|
||||||
|
"-Wno-disabled-macro-expansion",
|
||||||
|
"-Wno-global-constructors",
|
||||||
|
);
|
||||||
};
|
};
|
||||||
name = Debug;
|
name = Debug;
|
||||||
};
|
};
|
||||||
4A6D0C2C149B3D3B00DB3EAA /* Release */ = {
|
4A6D0C2C149B3D3B00DB3EAA /* Release */ = {
|
||||||
isa = XCBuildConfiguration;
|
isa = XCBuildConfiguration;
|
||||||
buildSettings = {
|
buildSettings = {
|
||||||
|
CLANG_ANALYZER_SECURITY_FLOATLOOPCOUNTER = YES;
|
||||||
|
CLANG_WARN__DUPLICATE_METHOD_MATCH = NO;
|
||||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||||
|
WARNING_CFLAGS = (
|
||||||
|
"-Weverything",
|
||||||
|
"-Wno-disabled-macro-expansion",
|
||||||
|
"-Wno-global-constructors",
|
||||||
|
);
|
||||||
};
|
};
|
||||||
name = Release;
|
name = Release;
|
||||||
};
|
};
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user