Compare commits

...

16 Commits

Author SHA1 Message Date
Phil Nash
5d6c1f4dd0 Dev build 2 2017-08-18 15:58:00 +01:00
Phil Nash
3bc03cd617 Went back to Catch 1.x behaviour for -d
-d takes "yes" or "no", rather than being a standalone flag option. The default is "defaultForReporter" so the previous change actually dropped some control.
2017-08-18 15:53:10 +01:00
Phil Nash
28f11a7149 Added dummy listener registration 2017-08-17 19:40:48 +01:00
Martin Hořeňovský
24af32f378 Add define that pulls in reporter and listeners interfaces
This allows users to define reporters and listeners in files different
from the main file.

Related to #991, #986
2017-08-17 20:23:30 +02:00
Phil Nash
0545de0a31 Hold translated exception in local string while matching 2017-08-17 19:21:00 +01:00
Phil Nash
ee75b324e7 Rebased with missing [failing] tag 2017-08-17 19:21:00 +01:00
Martin Hořeňovský
597fca3c89 Remove <algorithm> header from the common path
It was only used for std::max<double> within Approx, so we now have
::Catch::Detail::max(double, double) that is used instead.
2017-08-17 20:04:53 +02:00
Martin Hořeňovský
f99f511155 Removed *_REGISTER_REPORTER from main path
Also simplified them to single macro: CATCH_REGISTER_REPORTER
2017-08-17 20:03:16 +02:00
Martin Hořeňovský
9a18ba042f Remove deprecated listener registration macro 2017-08-17 20:03:16 +02:00
Martin Hořeňovský
8e6641c19b Replace stdint.h include with cstdint include
Just small unification of includes
2017-08-17 20:03:16 +02:00
Martin Hořeňovský
185573e701 Do not include c++ stitch marking in final single header 2017-08-17 20:03:15 +02:00
Phil Nash
632e023ff4 Added non-copyable test to [failing] set 2017-08-17 16:55:35 +01:00
Phil Nash
b8f482b9aa Added test comparing non-copyable values 2017-08-17 16:48:46 +01:00
Phil Nash
aaedae60b4 Fixed issue with comparing non-copyable values 2017-08-17 16:46:05 +01:00
Phil Nash
ff9aaf3afe Added Clara and TextFlowCpp to open source users 2017-08-17 10:48:53 +01:00
Phil Nash
e6ffbb732a Updated conan files to use version number 2017-08-17 08:40:58 +01:00
29 changed files with 168 additions and 113 deletions

View File

@@ -138,6 +138,7 @@ set(INTERNAL_HEADERS
${HEADER_DIR}/internal/catch_enforce.h
${HEADER_DIR}/internal/catch_errno_guard.h
${HEADER_DIR}/internal/catch_exception_translator_registry.h
${HEADER_DIR}/internal/catch_external_interfaces.h
${HEADER_DIR}/internal/catch_fatal_condition.h
${HEADER_DIR}/internal/catch_impl.hpp
${HEADER_DIR}/internal/catch_interfaces_capture.h

View File

@@ -4,7 +4,7 @@ from conans import ConanFile
class CatchConan(ConanFile):
name = "Catch"
version = "1.9.6"
version = "2.0.0-develop.2"
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
author = "philsquared"
generators = "cmake"

View File

@@ -25,6 +25,9 @@ The core part of the Chakra Javascript engine that powers Microsoft Edge
### [ChaiScript](https://github.com/ChaiScript/ChaiScript)
A, header-only, embedded scripting language designed from the ground up to directly target C++ and take advantage of modern C++ development techniques
### [Clara](https://github.com/philsquared/Clara)
A, single-header-only, type-safe, command line parser - which also prints formatted usage strings.
### [Couchbase-lite-core](https://github.com/couchbase/couchbase-lite-core)
The next-generation core storage and query engine for Couchbase Lite/
@@ -52,6 +55,9 @@ A C++ client library for Consul. Consul is a distributed tool for discovering an
### [Reactive-Extensions/ RxCpp](https://github.com/Reactive-Extensions/RxCpp)
A library of algorithms for values-distributed-in-time
### [TextFlowCpp](https://github.com/philsquared/textflowcpp)
A small, single-header-only, library for wrapping and composing columns of text
### [Trompeloeil](https://github.com/rollbear/trompeloeil)
A thread safe header only mocking framework for C++14

View File

@@ -19,6 +19,7 @@
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
# define CATCH_IMPL
# define CATCH_CONFIG_EXTERNAL_INTERFACES
#endif
#ifdef CATCH_IMPL
@@ -52,6 +53,10 @@
#include "internal/catch_objc.hpp"
#endif
#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
#include "internal/catch_external_interfaces.h"
#endif
#ifdef CATCH_IMPL
#include "internal/catch_impl.hpp"
#endif
@@ -115,8 +120,6 @@
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
// "BDD-style" convenience wrappers
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
@@ -175,8 +178,6 @@
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
#endif
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )

View File

@@ -13,6 +13,13 @@
namespace Catch {
namespace Detail {
double max(double lhs, double rhs) {
if (lhs < rhs) {
return rhs;
}
return lhs;
}
Approx::Approx ( double value )
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
m_margin( 0.0 ),

View File

@@ -10,7 +10,6 @@
#include "catch_tostring.h"
#include <algorithm>
#include <cmath>
#include <type_traits>
@@ -18,6 +17,8 @@
namespace Catch {
namespace Detail {
double max(double lhs, double rhs);
class Approx {
public:
explicit Approx ( double value );
@@ -42,7 +43,7 @@ namespace Detail {
friend bool operator == ( const T& lhs, Approx const& rhs ) {
// Thanks to Richard Harris for his help refining this formula
auto lhs_v = static_cast<double>(lhs);
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
if (relativeOK) {
return true;
}

View File

@@ -16,7 +16,8 @@ namespace Catch {
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
// the Equals matcher (so the header does not mention matchers)
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
MatchExpr<std::string, StringMatcher const&> expr( Catch::translateActiveException(), matcher, matcherString );
std::string exceptionMessage = Catch::translateActiveException();
MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
handler.handle( expr );
}

View File

@@ -135,7 +135,7 @@ namespace Catch {
+ Opt( setWarning, "warning name" )
["-w"]["--warn"]
( "enable warnings" )
+ Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
+ Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
["-d"]["--durations"]
( "show test durations" )
+ Opt( loadTestNamesFromFile, "filename" )

View File

@@ -76,14 +76,14 @@ namespace Catch {
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
template<typename LhsT, typename RhsT>
auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; };
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) == rhs; };
template<typename T>
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
template<typename T>
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
template<typename LhsT, typename RhsT>
auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) != rhs; };
template<typename T>
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
template<typename T>

View File

@@ -0,0 +1,13 @@
/*
* Created by Martin on 17/08/2017.
*
* 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_EXTERNAL_INTERFACES_H
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
#include "../reporters/catch_reporter_bases.hpp"
#include "catch_reporter_registrars.hpp"
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H

View File

@@ -1,3 +1,4 @@
/*
* Created by Phil on 31/12/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
@@ -39,7 +40,7 @@ namespace Catch {
class ListenerFactory : public IReporterFactory {
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
return std::make_shared<T>( config );
return std::unique_ptr<T>( new T( config ) );
}
virtual std::string getDescription() const override {
return std::string();
@@ -54,13 +55,9 @@ namespace Catch {
};
}
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
// Deprecated - use the form without INTERNAL_
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
#define CATCH_REGISTER_LISTENER( listenerType ) \
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }

View File

@@ -8,7 +8,7 @@
#ifndef TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
#define TWOBLUECUBES_CATCH_TIMER_H_INCLUDED
#include <stdint.h>
#include <cstdint>
namespace Catch {

View File

@@ -37,7 +37,7 @@ namespace Catch {
}
Version const& libraryVersion() {
static Version version( 2, 0, 0, "develop", 1 );
static Version version( 2, 0, 0, "develop", 2 );
return version;
}

View File

@@ -55,7 +55,7 @@ namespace Catch {
AutomakeReporter::~AutomakeReporter() {}
#endif
INTERNAL_CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
CATCH_REGISTER_REPORTER( "automake", AutomakeReporter)
} // end namespace Catch

View File

@@ -299,6 +299,6 @@ namespace Catch {
CompactReporter::~CompactReporter() {}
INTERNAL_CATCH_REGISTER_REPORTER( "compact", CompactReporter )
CATCH_REGISTER_REPORTER( "compact", CompactReporter )
} // end namespace Catch

View File

@@ -634,7 +634,7 @@ namespace Catch {
bool m_headerPrinted = false;
};
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
ConsoleReporter::~ConsoleReporter() {}

View File

@@ -251,6 +251,6 @@ namespace Catch {
};
JunitReporter::~JunitReporter() {}
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
CATCH_REGISTER_REPORTER( "junit", JunitReporter )
} // end namespace Catch

View File

@@ -248,7 +248,7 @@ namespace Catch {
TAPReporter::~TAPReporter() {}
#endif
INTERNAL_CATCH_REGISTER_REPORTER( "tap", TAPReporter )
CATCH_REGISTER_REPORTER( "tap", TAPReporter )
} // end namespace Catch

View File

@@ -206,7 +206,7 @@ namespace Catch {
TeamCityReporter::~TeamCityReporter() {}
#endif
INTERNAL_CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
CATCH_REGISTER_REPORTER( "teamcity", TeamCityReporter )
} // end namespace Catch

View File

@@ -220,6 +220,6 @@ namespace Catch {
};
XmlReporter::~XmlReporter() {}
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
CATCH_REGISTER_REPORTER( "xml", XmlReporter )
} // end namespace Catch

View File

@@ -1020,6 +1020,6 @@ with expansion:
"{?}" == "1"
===============================================================================
test cases: 182 | 131 passed | 47 failed | 4 failed as expected
assertions: 881 | 764 passed | 96 failed | 21 failed as expected
test cases: 183 | 132 passed | 47 failed | 4 failed as expected
assertions: 882 | 765 passed | 96 failed | 21 failed as expected

View File

@@ -6672,6 +6672,18 @@ PASSED:
with expansion:
"7" == "7"
-------------------------------------------------------------------------------
non-copyable objects
-------------------------------------------------------------------------------
TrickyTests.cpp:<line number>
...............................................................................
TrickyTests.cpp:<line number>:
PASSED:
CHECK( ti == typeid(int) )
with expansion:
{?} == {?}
-------------------------------------------------------------------------------
not allowed
-------------------------------------------------------------------------------
@@ -7523,6 +7535,6 @@ MiscTests.cpp:<line number>:
PASSED:
===============================================================================
test cases: 182 | 128 passed | 50 failed | 4 failed as expected
assertions: 883 | 760 passed | 102 failed | 21 failed as expected
test cases: 183 | 129 passed | 50 failed | 4 failed as expected
assertions: 884 | 761 passed | 102 failed | 21 failed as expected

View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="15" failures="88" tests="884" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="15" failures="88" tests="885" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="<exe-name>.global" name="# A test name that starts with a #" time="{duration}"/>
<testcase classname="<exe-name>.global" name="#748 - captures with unexpected exceptions/outside assertions" time="{duration}">
<error type="TEST_CASE">
@@ -725,6 +725,7 @@ MiscTests.cpp:<line number>
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1" time="{duration}"/>
<testcase classname="<exe-name>.global" name="nested SECTION tests/s1/s2" time="{duration}"/>
<testcase classname="<exe-name>.global" name="non streamable - with conv. op" time="{duration}"/>
<testcase classname="<exe-name>.global" name="non-copyable objects" time="{duration}"/>
<testcase classname="<exe-name>.global" name="not allowed" time="{duration}"/>
<testcase classname="<exe-name>.global" name="null strings" time="{duration}"/>
<testcase classname="<exe-name>.global" name="null_ptr" time="{duration}"/>

View File

@@ -7433,6 +7433,17 @@ loose text artifact
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="non-copyable objects" tags="[.][failing][hide]" filename="projects/<exe-name>/TrickyTests.cpp" >
<Expression success="true" type="CHECK" filename="projects/<exe-name>/TrickyTests.cpp" >
<Original>
ti == typeid(int)
</Original>
<Expanded>
{?} == {?}
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="not allowed" tags="[!throws]" filename="projects/<exe-name>/MiscTests.cpp" >
<OverallResult success="true"/>
</TestCase>
@@ -8276,7 +8287,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="760" failures="103" expectedFailures="21"/>
<OverallResults successes="761" failures="103" expectedFailures="21"/>
</Group>
<OverallResults successes="760" failures="102" expectedFailures="21"/>
<OverallResults successes="761" failures="102" expectedFailures="21"/>
</Catch>

View File

@@ -24,25 +24,11 @@ CATCH_REGISTER_TAG_ALIAS( "[@tricky]", "[tricky]~[.]" )
# pragma clang diagnostic ignored "-Wc++98-compat"
#endif
struct TestListener : Catch::TestEventListenerBase {
using TestEventListenerBase::TestEventListenerBase; // inherit constructor
};
CATCH_REGISTER_LISTENER( TestListener );
//template<size_t size>
//void parseIntoConfig( const char * (&argv)[size], Catch::ConfigData& config ) {
// auto parser = Catch::makeCommandLineParser();
// parser.parseInto( Catch::Clara::argsToVector( size, argv ), config );
//}
//
//template<size_t size>
//std::string parseIntoConfigAndReturnError( const char * (&argv)[size], Catch::ConfigData& config ) {
// try {
// parseIntoConfig( argv, config );
// FAIL( "expected exception" );
// }
// catch( std::exception& ex ) {
// return ex.what();
// }
// return "";
//}
//
inline Catch::TestCase fakeTestCase( const char* name, const char* desc = "" ){ return Catch::makeTestCase( nullptr, "", name, desc, CATCH_INTERNAL_LINEINFO ); }
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {

View File

@@ -435,3 +435,9 @@ TEST_CASE( "null deref", "[.][failing][!nonportable]" ) {
int *x = NULL;
*x = 1;
}
TEST_CASE( "non-copyable objects", "[.][failing]" ) {
// Thanks to Agustin Bergé (@k-ballo on the cpplang Slack) for raising this
std::type_info const& ti = typeid(int);
CHECK( ti == typeid(int) );
}

View File

@@ -71,6 +71,7 @@ def parseFile( path, filename ):
for line in f:
if '// ~*~* CATCH_CPP_STITCH_PLACE *~*~' in line:
insertCpps()
continue
elif ifParser.match( line ):
ifdefs = ifdefs + 1
elif endIfParser.match( line ):

View File

@@ -1,6 +1,6 @@
/*
* Catch v2.0.0-develop.1
* Generated: 2017-08-17 08:29:20.059622
* Catch v2.0.0-develop.2
* Generated: 2017-08-18 15:57:31.231591
* ----------------------------------------------------------
* This file has been merged from multiple headers. Please don't edit it directly
* Copyright (c) 2017 Two Blue Cubes Ltd. All rights reserved.
@@ -46,6 +46,7 @@
// end catch_suppress_warnings.h
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
# define CATCH_IMPL
# define CATCH_CONFIG_EXTERNAL_INTERFACES
#endif
#ifdef CATCH_IMPL
@@ -914,14 +915,14 @@ namespace Catch {
// Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int)
template<typename LhsT, typename RhsT>
auto compareEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs == rhs; };
auto compareEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) == rhs; };
template<typename T>
auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast<void const*>( rhs ); };
template<typename T>
auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast<void const*>( lhs ) == rhs; };
template<typename LhsT, typename RhsT>
auto compareNotEqual( LhsT lhs, RhsT&& rhs ) -> bool { return lhs != rhs; };
auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return const_cast<LhsT&>( lhs ) != rhs; };
template<typename T>
auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast<void const*>( rhs ); };
template<typename T>
@@ -1493,7 +1494,7 @@ namespace Catch {
// end catch_section_info.h
// start catch_timer.h
#include <stdint.h>
#include <cstdint>
namespace Catch {
@@ -1701,7 +1702,6 @@ namespace Catch {
// end catch_interfaces_exception.h
// start catch_approx.hpp
#include <algorithm>
#include <cmath>
#include <type_traits>
@@ -1709,6 +1709,8 @@ namespace Catch {
namespace Catch {
namespace Detail {
double max(double lhs, double rhs);
class Approx {
public:
explicit Approx ( double value );
@@ -1732,7 +1734,7 @@ namespace Detail {
friend bool operator == ( const T& lhs, Approx const& rhs ) {
// Thanks to Richard Harris for his help refining this formula
auto lhs_v = static_cast<double>(lhs);
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (std::max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
bool relativeOK = std::fabs(lhs_v - rhs.m_value) < rhs.m_epsilon * (rhs.m_scale + (max)(std::fabs(lhs_v), std::fabs(rhs.m_value)));
if (relativeOK) {
return true;
}
@@ -2536,43 +2538,11 @@ return @ desc; \
// end catch_objc.hpp
#endif
#ifdef CATCH_IMPL
// start catch_impl.hpp
#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
// start catch_external_interfaces.h
#ifndef TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
#define TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
// Collect all the implementation files together here
// These are the equivalent of what would usually be cpp files
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wweak-vtables"
#endif
// start catch_notimplemented_exception.h
#include <exception>
namespace Catch {
class NotImplementedException : public std::exception
{
public:
NotImplementedException( SourceLineInfo const& lineInfo );
virtual ~NotImplementedException() noexcept = default;
virtual const char* what() const noexcept override;
private:
std::string m_what;
};
} // end namespace Catch
///////////////////////////////////////////////////////////////////////////////
#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
// end catch_notimplemented_exception.h
// Temporary hack to fix separately provided reporters
// start catch_reporter_bases.hpp
// start catch_enforce.h
@@ -3596,6 +3566,7 @@ namespace Catch {
// end catch_reporter_bases.hpp
// start catch_reporter_registrars.hpp
namespace Catch {
template<typename T>
@@ -3625,7 +3596,7 @@ namespace Catch {
class ListenerFactory : public IReporterFactory {
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override {
return std::make_shared<T>( config );
return std::unique_ptr<T>( new T( config ) );
}
virtual std::string getDescription() const override {
return std::string();
@@ -3640,17 +3611,54 @@ namespace Catch {
};
}
#define INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType ) \
#define CATCH_REGISTER_REPORTER( name, reporterType ) \
namespace{ Catch::ReporterRegistrar<reporterType> catch_internal_RegistrarFor##reporterType( name ); }
// Deprecated - use the form without INTERNAL_
#define INTERNAL_CATCH_REGISTER_LISTENER( listenerType ) \
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
#define CATCH_REGISTER_LISTENER( listenerType ) \
namespace{ Catch::ListenerRegistrar<listenerType> catch_internal_RegistrarFor##listenerType; }
// end catch_reporter_registrars.hpp
#endif // TWOBLUECUBES_CATCH_EXTERNAL_INTERFACES_H
// end catch_external_interfaces.h
#endif
#ifdef CATCH_IMPL
// start catch_impl.hpp
// Collect all the implementation files together here
// These are the equivalent of what would usually be cpp files
#ifdef __clang__
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wweak-vtables"
#endif
// start catch_notimplemented_exception.h
#include <exception>
namespace Catch {
class NotImplementedException : public std::exception
{
public:
NotImplementedException( SourceLineInfo const& lineInfo );
virtual ~NotImplementedException() noexcept = default;
virtual const char* what() const noexcept override;
private:
std::string m_what;
};
} // end namespace Catch
///////////////////////////////////////////////////////////////////////////////
#define CATCH_NOT_IMPLEMENTED throw Catch::NotImplementedException( CATCH_INTERNAL_LINEINFO )
// end catch_notimplemented_exception.h
// Temporary hack to fix separately provided reporters
//
// start catch_leak_detector.h
@@ -5696,6 +5704,13 @@ namespace Catch {
namespace Catch {
namespace Detail {
double max(double lhs, double rhs) {
if (lhs < rhs) {
return rhs;
}
return lhs;
}
Approx::Approx ( double value )
: m_epsilon( std::numeric_limits<float>::epsilon()*100 ),
m_margin( 0.0 ),
@@ -5978,7 +5993,8 @@ namespace Catch {
// There is another overload, in catch_assertinhandler.h/.cpp, that only takes a string and infers
// the Equals matcher (so the header does not mention matchers)
void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef matcherString ) {
MatchExpr<std::string, StringMatcher const&> expr( Catch::translateActiveException(), matcher, matcherString );
std::string exceptionMessage = Catch::translateActiveException();
MatchExpr<std::string, StringMatcher const&> expr( exceptionMessage, matcher, matcherString );
handler.handle( expr );
}
@@ -6111,7 +6127,7 @@ namespace Catch {
+ Opt( setWarning, "warning name" )
["-w"]["--warn"]
( "enable warnings" )
+ Opt( [&]( bool ) { config.showDurations = ShowDurations::Always; } )
+ Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" )
["-d"]["--durations"]
( "show test durations" )
+ Opt( loadTestNamesFromFile, "filename" )
@@ -9484,7 +9500,7 @@ namespace Catch {
}
Version const& libraryVersion() {
static Version version( 2, 0, 0, "develop", 1 );
static Version version( 2, 0, 0, "develop", 2 );
return version;
}
@@ -10143,7 +10159,7 @@ namespace Catch {
CompactReporter::~CompactReporter() {}
INTERNAL_CATCH_REGISTER_REPORTER( "compact", CompactReporter )
CATCH_REGISTER_REPORTER( "compact", CompactReporter )
} // end namespace Catch
// end catch_reporter_compact.cpp
@@ -10768,7 +10784,7 @@ namespace Catch {
bool m_headerPrinted = false;
};
INTERNAL_CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
CATCH_REGISTER_REPORTER( "console", ConsoleReporter )
ConsoleReporter::~ConsoleReporter() {}
@@ -11014,7 +11030,7 @@ namespace Catch {
};
JunitReporter::~JunitReporter() {}
INTERNAL_CATCH_REGISTER_REPORTER( "junit", JunitReporter )
CATCH_REGISTER_REPORTER( "junit", JunitReporter )
} // end namespace Catch
// end catch_reporter_junit.cpp
@@ -11311,11 +11327,10 @@ namespace Catch {
};
XmlReporter::~XmlReporter() {}
INTERNAL_CATCH_REGISTER_REPORTER( "xml", XmlReporter )
CATCH_REGISTER_REPORTER( "xml", XmlReporter )
} // end namespace Catch
// end catch_reporter_xml.cpp
// ~*~* CATCH_CPP_STITCH_PLACE *~*~
namespace Catch {
LeakDetector leakDetector;
@@ -11443,8 +11458,6 @@ int main (int argc, char * const argv[]) {
#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
#define CATCH_REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
// "BDD-style" convenience wrappers
#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ )
#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ )
@@ -11502,8 +11515,6 @@ int main (int argc, char * const argv[]) {
#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE()
#define REGISTER_REPORTER( name, reporterType ) INTERNAL_CATCH_REGISTER_REPORTER( name, reporterType )
#endif
#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature )

View File

@@ -10,7 +10,7 @@ class CatchConanTest(ConanFile):
settings = "os", "compiler", "arch", "build_type"
username = getenv("CONAN_USERNAME", "philsquared")
channel = getenv("CONAN_CHANNEL", "testing")
requires = "Catch/1.9.5@%s/%s" % (username, channel)
requires = "Catch/2.0.0-develop.2@%s/%s" % (username, channel)
def build(self):
cmake = CMake(self)