mirror of
https://github.com/catchorg/Catch2.git
synced 2025-04-29 04:03:51 +00:00
Compare commits
8 Commits
c770a9c8b5
...
49e000b505
Author | SHA1 | Date | |
---|---|---|---|
|
49e000b505 | ||
|
2e1ce37faa | ||
|
d0257fc1ff | ||
|
df2379218b | ||
|
7134ad9913 | ||
|
827733fe81 | ||
|
2f4a7dda68 | ||
|
6c3a5ef625 |
@ -49,7 +49,7 @@ class BuilderSettings(object):
|
|||||||
def reference(self):
|
def reference(self):
|
||||||
""" Read project version from branch create Conan reference
|
""" Read project version from branch create Conan reference
|
||||||
"""
|
"""
|
||||||
return os.getenv("CONAN_REFERENCE", "Catch2/{}".format(self._version))
|
return os.getenv("CONAN_REFERENCE", "catch2/{}".format(self._version))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def channel(self):
|
def channel(self):
|
||||||
@ -85,7 +85,7 @@ if __name__ == "__main__":
|
|||||||
reference=settings.reference,
|
reference=settings.reference,
|
||||||
channel=settings.channel,
|
channel=settings.channel,
|
||||||
upload=settings.upload,
|
upload=settings.upload,
|
||||||
upload_only_when_stable=settings.upload_only_when_stable,
|
upload_only_when_stable=False,
|
||||||
stable_branch_pattern=settings.stable_branch_pattern,
|
stable_branch_pattern=settings.stable_branch_pattern,
|
||||||
login_username=settings.login_username,
|
login_username=settings.login_username,
|
||||||
username=settings.username,
|
username=settings.username,
|
||||||
|
@ -1,11 +1,19 @@
|
|||||||
cmake_minimum_required(VERSION 3.2.0)
|
cmake_minimum_required(VERSION 3.2.0)
|
||||||
project(test_package CXX)
|
project(test_package CXX)
|
||||||
|
|
||||||
include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
|
# We set it only for the convenience of calling the executable
|
||||||
conan_basic_setup(TARGETS)
|
# in the package test function
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
|
||||||
|
|
||||||
find_package(Catch2 REQUIRED CONFIG)
|
find_package(Catch2 REQUIRED CONFIG)
|
||||||
|
|
||||||
add_executable(${PROJECT_NAME} test_package.cpp)
|
add_executable(${PROJECT_NAME} test_package.cpp)
|
||||||
target_link_libraries(${PROJECT_NAME} CONAN_PKG::Catch2)
|
# Note: Conan 1.21 doesn't support granular target generation yet.
|
||||||
|
# The Main library would be included into the unified target.
|
||||||
|
# It's controlled by the `with_main` option in the recipe.
|
||||||
|
target_link_libraries(${PROJECT_NAME} Catch2::Catch2)
|
||||||
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
|
set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14)
|
||||||
|
@ -6,7 +6,7 @@ import os
|
|||||||
|
|
||||||
class TestPackageConan(ConanFile):
|
class TestPackageConan(ConanFile):
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
generators = "cmake"
|
generators = "cmake_find_package_multi"
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
@ -14,6 +14,6 @@ class TestPackageConan(ConanFile):
|
|||||||
cmake.build()
|
cmake.build()
|
||||||
|
|
||||||
def test(self):
|
def test(self):
|
||||||
assert os.path.isfile(os.path.join(self.deps_cpp_info["Catch2"].rootpath, "licenses", "LICENSE.txt"))
|
assert os.path.isfile(os.path.join(self.deps_cpp_info["catch2"].rootpath, "licenses", "LICENSE.txt"))
|
||||||
bin_path = os.path.join("bin", "test_package")
|
bin_path = os.path.join("bin", "test_package")
|
||||||
self.run("%s -s" % bin_path, run_environment=True)
|
self.run("%s -s" % bin_path, run_environment=True)
|
||||||
|
@ -1,6 +1,4 @@
|
|||||||
#define CATCH_CONFIG_MAIN
|
#include <catch2/catch_test_macros.hpp>
|
||||||
|
|
||||||
#include <catch2/catch.hpp>
|
|
||||||
|
|
||||||
int Factorial( int number ) {
|
int Factorial( int number ) {
|
||||||
return number <= 1 ? 1 : Factorial( number - 1 ) * number;
|
return number <= 1 ? 1 : Factorial( number - 1 ) * number;
|
||||||
|
24
.travis.yml
24
.travis.yml
@ -158,18 +158,18 @@ matrix:
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
# # Special builds, e.g. conan
|
# Special builds, e.g. conan
|
||||||
# - language: python
|
- language: python
|
||||||
# python:
|
python:
|
||||||
# - "3.7"
|
- "3.7"
|
||||||
# install:
|
install:
|
||||||
# - pip install conan-package-tools
|
- pip install conan-package-tools
|
||||||
# env:
|
env:
|
||||||
# - CONAN_GCC_VERSIONS=8
|
- CONAN_GCC_VERSIONS=8
|
||||||
# - CONAN_DOCKER_IMAGE=conanio/gcc8
|
- CONAN_DOCKER_IMAGE=conanio/gcc8
|
||||||
# - CPP14=1
|
- CPP14=1
|
||||||
# script:
|
script:
|
||||||
# - python .conan/build.py
|
- python .conan/build.py
|
||||||
|
|
||||||
before_script:
|
before_script:
|
||||||
- export CXX=${COMPILER}
|
- export CXX=${COMPILER}
|
||||||
|
@ -25,7 +25,7 @@ if (CMAKE_BINARY_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
project(Catch2 LANGUAGES CXX VERSION 2.10.2)
|
project(Catch2 LANGUAGES CXX VERSION 3.0.0)
|
||||||
|
|
||||||
# Provide path for scripts
|
# Provide path for scripts
|
||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
|
||||||
|
16
conanfile.py
16
conanfile.py
@ -3,16 +3,20 @@ from conans import ConanFile, CMake
|
|||||||
|
|
||||||
|
|
||||||
class CatchConan(ConanFile):
|
class CatchConan(ConanFile):
|
||||||
name = "Catch2"
|
name = "catch2"
|
||||||
description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD"
|
description = "A modern, C++-native, framework for unit-tests, TDD and BDD"
|
||||||
topics = ("conan", "catch2", "unit-test", "tdd", "bdd")
|
topics = ("conan", "catch2", "unit-test", "tdd", "bdd")
|
||||||
url = "https://github.com/catchorg/Catch2"
|
url = "https://github.com/catchorg/Catch2"
|
||||||
homepage = url
|
homepage = url
|
||||||
license = "BSL-1.0"
|
license = "BSL-1.0"
|
||||||
|
|
||||||
exports = "LICENSE.txt"
|
exports = "LICENSE.txt"
|
||||||
exports_sources = ("src/*", "CMakeLists.txt", "CMake/*", "extras/*")
|
exports_sources = ("src/*", "CMakeLists.txt", "CMake/*", "extras/*")
|
||||||
|
|
||||||
settings = "os", "compiler", "build_type", "arch"
|
settings = "os", "compiler", "build_type", "arch"
|
||||||
generators = "cmake"
|
|
||||||
|
options = {"with_main": [True, False]}
|
||||||
|
default_options = {"with_main": True}
|
||||||
|
|
||||||
def _configure_cmake(self):
|
def _configure_cmake(self):
|
||||||
cmake = CMake(self)
|
cmake = CMake(self)
|
||||||
@ -31,7 +35,11 @@ class CatchConan(ConanFile):
|
|||||||
cmake = self._configure_cmake()
|
cmake = self._configure_cmake()
|
||||||
cmake.install()
|
cmake.install()
|
||||||
|
|
||||||
|
def package_id(self):
|
||||||
|
del self.info.options.with_main
|
||||||
|
|
||||||
def package_info(self):
|
def package_info(self):
|
||||||
self.cpp_info.libs = ['Catch2Main', 'Catch2']
|
self.cpp_info.libs = [
|
||||||
|
'Catch2Main', 'Catch2'] if self.options.with_main else ['Catch2']
|
||||||
self.cpp_info.names["cmake_find_package"] = "Catch2"
|
self.cpp_info.names["cmake_find_package"] = "Catch2"
|
||||||
self.cpp_info.names["cmake_find_package_multi"] = "Catch2"
|
self.cpp_info.names["cmake_find_package_multi"] = "Catch2"
|
||||||
|
@ -146,7 +146,6 @@ by using `_NO_` in the macro, e.g. `CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS`.
|
|||||||
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
||||||
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
||||||
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
|
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
|
||||||
CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit
|
|
||||||
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
||||||
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
||||||
CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
|
CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression
|
||||||
@ -183,11 +182,6 @@ should not lead to false negatives.
|
|||||||
`CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined,
|
`CATCH_CONFIG_FAST_COMPILE` has to be either defined, or not defined,
|
||||||
in all translation units that are linked into single test binary.
|
in all translation units that are linked into single test binary.
|
||||||
|
|
||||||
### `CATCH_CONFIG_DISABLE_MATCHERS`
|
|
||||||
When `CATCH_CONFIG_DISABLE_MATCHERS` is defined, all mentions of Catch's Matchers are ifdef-ed away from the translation unit. Doing so will speed up compilation of that TU.
|
|
||||||
|
|
||||||
_Note: If you define `CATCH_CONFIG_DISABLE_MATCHERS` in the same file as Catch's main is implemented, your test executable will fail to link if you use Matchers anywhere._
|
|
||||||
|
|
||||||
### `CATCH_CONFIG_DISABLE_STRINGIFICATION`
|
### `CATCH_CONFIG_DISABLE_STRINGIFICATION`
|
||||||
This toggle enables a workaround for VS 2017 bug. For details see [known limitations](limitations.md#visual-studio-2017----raw-string-literal-in-assert-fails-to-compile).
|
This toggle enables a workaround for VS 2017 bug. For details see [known limitations](limitations.md#visual-studio-2017----raw-string-literal-in-assert-fails-to-compile).
|
||||||
|
|
||||||
|
@ -50,11 +50,14 @@
|
|||||||
* You can still write `SECTION("ShortName", "Long and wordy description")`, but the description is thrown away
|
* You can still write `SECTION("ShortName", "Long and wordy description")`, but the description is thrown away
|
||||||
* The description type now must be a `const char*` or implicitly convertible to it
|
* The description type now must be a `const char*` or implicitly convertible to it
|
||||||
|
|
||||||
|
|
||||||
### Fixes
|
### Fixes
|
||||||
* The `INFO` macro no longer contains superfluous semicolon (#1456)
|
* The `INFO` macro no longer contains superfluous semicolon (#1456)
|
||||||
* The `--list*` family of command line flags now return 0 on success (#1410, #1146)
|
* The `--list*` family of command line flags now return 0 on success (#1410, #1146)
|
||||||
|
|
||||||
|
### Other changes
|
||||||
|
* `CATCH_CONFIG_DISABLE_MATCHERS` no longer exists.
|
||||||
|
* If you do not want to use Matchers in a TU, do not include their header.
|
||||||
|
|
||||||
|
|
||||||
## 2.10.2
|
## 2.10.2
|
||||||
|
|
||||||
|
@ -26,9 +26,7 @@
|
|||||||
#include <catch2/catch_compiler_capabilities.h>
|
#include <catch2/catch_compiler_capabilities.h>
|
||||||
#include <catch2/catch_string_manip.h>
|
#include <catch2/catch_string_manip.h>
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#include <catch2/catch_capture_matchers.h>
|
#include <catch2/catch_capture_matchers.h>
|
||||||
#endif
|
|
||||||
#include <catch2/catch_generators.hpp>
|
#include <catch2/catch_generators.hpp>
|
||||||
#include <catch2/catch_generators_generic.hpp>
|
#include <catch2/catch_generators_generic.hpp>
|
||||||
#include <catch2/catch_generators_specific.hpp>
|
#include <catch2/catch_generators_specific.hpp>
|
||||||
|
@ -28,7 +28,7 @@ namespace Catch {
|
|||||||
|
|
||||||
class StartupExceptionRegistry;
|
class StartupExceptionRegistry;
|
||||||
|
|
||||||
using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
|
using IReporterFactoryPtr = std::unique_ptr<IReporterFactory>;
|
||||||
|
|
||||||
struct IRegistryHub {
|
struct IRegistryHub {
|
||||||
virtual ~IRegistryHub();
|
virtual ~IRegistryHub();
|
||||||
@ -44,8 +44,8 @@ namespace Catch {
|
|||||||
|
|
||||||
struct IMutableRegistryHub {
|
struct IMutableRegistryHub {
|
||||||
virtual ~IMutableRegistryHub();
|
virtual ~IMutableRegistryHub();
|
||||||
virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0;
|
virtual void registerReporter( std::string const& name, IReporterFactoryPtr factory ) = 0;
|
||||||
virtual void registerListener( IReporterFactoryPtr const& factory ) = 0;
|
virtual void registerListener( IReporterFactoryPtr factory ) = 0;
|
||||||
virtual void registerTest(std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker) = 0;
|
virtual void registerTest(std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker) = 0;
|
||||||
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
virtual void registerTranslator( const IExceptionTranslator* translator ) = 0;
|
||||||
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
|
virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0;
|
||||||
|
@ -16,14 +16,14 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig )
|
ReporterConfig::ReporterConfig( IConfig const* _fullConfig )
|
||||||
: m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
|
: m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {}
|
||||||
|
|
||||||
ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream )
|
ReporterConfig::ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream )
|
||||||
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
|
: m_stream( &_stream ), m_fullConfig( _fullConfig ) {}
|
||||||
|
|
||||||
std::ostream& ReporterConfig::stream() const { return *m_stream; }
|
std::ostream& ReporterConfig::stream() const { return *m_stream; }
|
||||||
IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; }
|
IConfig const * ReporterConfig::fullConfig() const { return m_fullConfig; }
|
||||||
|
|
||||||
|
|
||||||
TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
|
TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {}
|
||||||
|
@ -37,16 +37,16 @@ namespace Catch {
|
|||||||
struct TagInfo;
|
struct TagInfo;
|
||||||
|
|
||||||
struct ReporterConfig {
|
struct ReporterConfig {
|
||||||
explicit ReporterConfig( IConfigPtr const& _fullConfig );
|
explicit ReporterConfig( IConfig const* _fullConfig );
|
||||||
|
|
||||||
ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream );
|
ReporterConfig( IConfig const* _fullConfig, std::ostream& _stream );
|
||||||
|
|
||||||
std::ostream& stream() const;
|
std::ostream& stream() const;
|
||||||
IConfigPtr fullConfig() const;
|
IConfig const* fullConfig() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::ostream* m_stream;
|
std::ostream* m_stream;
|
||||||
IConfigPtr m_fullConfig;
|
IConfig const* m_fullConfig;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct ReporterPreferences {
|
struct ReporterPreferences {
|
||||||
@ -261,14 +261,14 @@ namespace Catch {
|
|||||||
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
|
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0;
|
||||||
virtual std::string getDescription() const = 0;
|
virtual std::string getDescription() const = 0;
|
||||||
};
|
};
|
||||||
using IReporterFactoryPtr = std::shared_ptr<IReporterFactory>;
|
using IReporterFactoryPtr = std::unique_ptr<IReporterFactory>;
|
||||||
|
|
||||||
struct IReporterRegistry {
|
struct IReporterRegistry {
|
||||||
using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
|
using FactoryMap = std::map<std::string, IReporterFactoryPtr>;
|
||||||
using Listeners = std::vector<IReporterFactoryPtr>;
|
using Listeners = std::vector<IReporterFactoryPtr>;
|
||||||
|
|
||||||
virtual ~IReporterRegistry();
|
virtual ~IReporterRegistry();
|
||||||
virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0;
|
virtual IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const = 0;
|
||||||
virtual FactoryMap const& getFactories() const = 0;
|
virtual FactoryMap const& getFactories() const = 0;
|
||||||
virtual Listeners const& getListeners() const = 0;
|
virtual Listeners const& getListeners() const = 0;
|
||||||
};
|
};
|
||||||
|
@ -29,13 +29,13 @@ namespace Catch {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
void listTests(IStreamingReporter& reporter, Config const& config) {
|
void listTests(IStreamingReporter& reporter, Config const& config) {
|
||||||
TestSpec testSpec = config.testSpec();
|
auto const& testSpec = config.testSpec();
|
||||||
auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
auto matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
||||||
reporter.listTests(matchedTestCases, config);
|
reporter.listTests(matchedTestCases, config);
|
||||||
}
|
}
|
||||||
|
|
||||||
void listTags(IStreamingReporter& reporter, Config const& config) {
|
void listTags(IStreamingReporter& reporter, Config const& config) {
|
||||||
TestSpec testSpec = config.testSpec();
|
auto const& testSpec = config.testSpec();
|
||||||
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
std::vector<TestCaseHandle> matchedTestCases = filterTests(getAllTestCasesSorted(config), testSpec, config);
|
||||||
|
|
||||||
std::map<StringRef, TagInfo> tagCounts;
|
std::map<StringRef, TagInfo> tagCounts;
|
||||||
|
@ -103,7 +103,6 @@ namespace Catch {
|
|||||||
return noTestMethods;
|
return noTestMethods;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
|
|
||||||
namespace Matchers {
|
namespace Matchers {
|
||||||
namespace Impl {
|
namespace Impl {
|
||||||
@ -193,8 +192,6 @@ namespace Catch {
|
|||||||
|
|
||||||
using namespace Matchers;
|
using namespace Matchers;
|
||||||
|
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
} // namespace Catch
|
} // namespace Catch
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -43,11 +43,11 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public: // IMutableRegistryHub
|
public: // IMutableRegistryHub
|
||||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override {
|
void registerReporter( std::string const& name, IReporterFactoryPtr factory ) override {
|
||||||
m_reporterRegistry.registerReporter( name, factory );
|
m_reporterRegistry.registerReporter( name, std::move(factory) );
|
||||||
}
|
}
|
||||||
void registerListener( IReporterFactoryPtr const& factory ) override {
|
void registerListener( IReporterFactoryPtr factory ) override {
|
||||||
m_reporterRegistry.registerListener( factory );
|
m_reporterRegistry.registerListener( std::move(factory) );
|
||||||
}
|
}
|
||||||
void registerTest( std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker ) override {
|
void registerTest( std::unique_ptr<TestCaseInfo>&& testInfo, std::unique_ptr<ITestInvoker>&& invoker ) override {
|
||||||
m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) );
|
m_testCaseRegistry.registerTest( std::move(testInfo), std::move(invoker) );
|
||||||
|
@ -17,7 +17,7 @@ namespace Catch {
|
|||||||
class ReporterFactory : public IReporterFactory {
|
class ReporterFactory : public IReporterFactory {
|
||||||
|
|
||||||
IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
IStreamingReporterPtr create( ReporterConfig const& config ) const override {
|
||||||
return std::unique_ptr<T>( new T( config ) );
|
return std::make_unique<T>( config );
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getDescription() const override {
|
std::string getDescription() const override {
|
||||||
@ -50,7 +50,7 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
ListenerRegistrar() {
|
ListenerRegistrar() {
|
||||||
getMutableRegistryHub().registerListener( std::make_shared<ListenerFactory>() );
|
getMutableRegistryHub().registerListener( std::make_unique<ListenerFactory>() );
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -18,30 +18,34 @@
|
|||||||
|
|
||||||
namespace Catch {
|
namespace Catch {
|
||||||
|
|
||||||
ReporterRegistry::ReporterRegistry():
|
ReporterRegistry::ReporterRegistry() {
|
||||||
m_factories({
|
// Because it is impossible to move out of initializer list,
|
||||||
{"automake", std::make_shared<ReporterFactory<AutomakeReporter>>() },
|
// we have to add the elements manually
|
||||||
{"compact", std::make_shared<ReporterFactory<CompactReporter>>() },
|
m_factories["automake"] = std::make_unique<ReporterFactory<AutomakeReporter>>();
|
||||||
{"console", std::make_shared<ReporterFactory<ConsoleReporter>>() },
|
m_factories["compact"] = std::make_unique<ReporterFactory<CompactReporter>>();
|
||||||
{"junit", std::make_shared<ReporterFactory<JunitReporter>>() },
|
m_factories["console"] = std::make_unique<ReporterFactory<ConsoleReporter>>();
|
||||||
{"sonarqube", std::make_shared<ReporterFactory<SonarQubeReporter>>() },
|
m_factories["junit"] = std::make_unique<ReporterFactory<JunitReporter>>();
|
||||||
{"tap", std::make_shared<ReporterFactory<TAPReporter>>() },
|
m_factories["sonarqube"] = std::make_unique<ReporterFactory<SonarQubeReporter>>();
|
||||||
{"teamcity", std::make_shared<ReporterFactory<TeamCityReporter>>() },
|
m_factories["tap"] = std::make_unique<ReporterFactory<TAPReporter>>();
|
||||||
{"xml", std::make_shared<ReporterFactory<XmlReporter>>() },
|
m_factories["teamcity"] = std::make_unique<ReporterFactory<TeamCityReporter>>();
|
||||||
}) {}
|
m_factories["xml"] = std::make_unique<ReporterFactory<XmlReporter>>();
|
||||||
|
}
|
||||||
|
|
||||||
IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const {
|
ReporterRegistry::~ReporterRegistry() = default;
|
||||||
|
|
||||||
|
|
||||||
|
IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfig const* config ) const {
|
||||||
auto it = m_factories.find( name );
|
auto it = m_factories.find( name );
|
||||||
if( it == m_factories.end() )
|
if( it == m_factories.end() )
|
||||||
return nullptr;
|
return nullptr;
|
||||||
return it->second->create( ReporterConfig( config ) );
|
return it->second->create( ReporterConfig( config ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) {
|
void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr factory ) {
|
||||||
m_factories.emplace(name, factory);
|
m_factories.emplace(name, std::move(factory));
|
||||||
}
|
}
|
||||||
void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) {
|
void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) {
|
||||||
m_listeners.push_back( factory );
|
m_listeners.push_back( std::move(factory) );
|
||||||
}
|
}
|
||||||
|
|
||||||
IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {
|
IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const {
|
||||||
|
@ -18,12 +18,12 @@ namespace Catch {
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
ReporterRegistry();
|
ReporterRegistry();
|
||||||
~ReporterRegistry() override = default;
|
~ReporterRegistry() override; // = default, out of line to allow fwd decl
|
||||||
|
|
||||||
IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override;
|
IStreamingReporterPtr create( std::string const& name, IConfig const* config ) const override;
|
||||||
|
|
||||||
void registerReporter( std::string const& name, IReporterFactoryPtr const& factory );
|
void registerReporter( std::string const& name, IReporterFactoryPtr factory );
|
||||||
void registerListener( IReporterFactoryPtr const& factory );
|
void registerListener( IReporterFactoryPtr factory );
|
||||||
|
|
||||||
FactoryMap const& getFactories() const override;
|
FactoryMap const& getFactories() const override;
|
||||||
Listeners const& getListeners() const override;
|
Listeners const& getListeners() const override;
|
||||||
|
@ -33,14 +33,14 @@ namespace Catch {
|
|||||||
namespace {
|
namespace {
|
||||||
const int MaxExitCode = 255;
|
const int MaxExitCode = 255;
|
||||||
|
|
||||||
IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) {
|
IStreamingReporterPtr createReporter(std::string const& reporterName, IConfig const* config) {
|
||||||
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
|
auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config);
|
||||||
CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'");
|
CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'");
|
||||||
|
|
||||||
return reporter;
|
return reporter;
|
||||||
}
|
}
|
||||||
|
|
||||||
IStreamingReporterPtr makeReporter(std::shared_ptr<Config> const& config) {
|
IStreamingReporterPtr makeReporter(Config const* config) {
|
||||||
if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) {
|
if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) {
|
||||||
return createReporter(config->getReporterName(), config);
|
return createReporter(config->getReporterName(), config);
|
||||||
}
|
}
|
||||||
@ -273,7 +273,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Create reporter(s) so we can route listings through them
|
// Create reporter(s) so we can route listings through them
|
||||||
auto reporter = makeReporter(m_config);
|
auto reporter = makeReporter(m_config.get());
|
||||||
|
|
||||||
// Handle list request
|
// Handle list request
|
||||||
if (list(*reporter, m_config)) {
|
if (list(*reporter, m_config)) {
|
||||||
|
@ -24,9 +24,7 @@
|
|||||||
#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
||||||
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
|
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
|
||||||
#endif// CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
|
|
||||||
#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
@ -38,16 +36,12 @@
|
|||||||
#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
||||||
|
|
||||||
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
|
#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg )
|
||||||
#define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg )
|
#define CATCH_UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "CATCH_UNSCOPED_INFO", msg )
|
||||||
@ -120,9 +114,7 @@
|
|||||||
#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr )
|
||||||
#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr )
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
|
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr )
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ )
|
||||||
|
|
||||||
#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
@ -134,17 +126,13 @@
|
|||||||
#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr )
|
||||||
#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr )
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ )
|
||||||
|
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg )
|
||||||
|
|
||||||
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg )
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
|
#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg )
|
||||||
#define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg )
|
#define UNSCOPED_INFO( msg ) INTERNAL_CATCH_UNSCOPED_INFO( "UNSCOPED_INFO", msg )
|
||||||
@ -228,9 +216,7 @@
|
|||||||
#define CATCH_REQUIRE_THROWS( ... ) (void)(0)
|
#define CATCH_REQUIRE_THROWS( ... ) (void)(0)
|
||||||
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||||
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||||
#endif// CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
|
#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0)
|
||||||
|
|
||||||
#define CATCH_CHECK( ... ) (void)(0)
|
#define CATCH_CHECK( ... ) (void)(0)
|
||||||
@ -242,16 +228,12 @@
|
|||||||
#define CATCH_CHECK_THROWS( ... ) (void)(0)
|
#define CATCH_CHECK_THROWS( ... ) (void)(0)
|
||||||
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||||
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define CATCH_CHECK_NOTHROW( ... ) (void)(0)
|
#define CATCH_CHECK_NOTHROW( ... ) (void)(0)
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
|
#define CATCH_CHECK_THAT( arg, matcher ) (void)(0)
|
||||||
|
|
||||||
#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
|
#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0)
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
#define CATCH_INFO( msg ) (void)(0)
|
#define CATCH_INFO( msg ) (void)(0)
|
||||||
#define CATCH_UNSCOPED_INFO( msg ) (void)(0)
|
#define CATCH_UNSCOPED_INFO( msg ) (void)(0)
|
||||||
@ -310,9 +292,7 @@
|
|||||||
#define REQUIRE_THROWS( ... ) (void)(0)
|
#define REQUIRE_THROWS( ... ) (void)(0)
|
||||||
#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||||
#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0)
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define REQUIRE_NOTHROW( ... ) (void)(0)
|
#define REQUIRE_NOTHROW( ... ) (void)(0)
|
||||||
|
|
||||||
#define CHECK( ... ) (void)(0)
|
#define CHECK( ... ) (void)(0)
|
||||||
@ -324,17 +304,12 @@
|
|||||||
#define CHECK_THROWS( ... ) (void)(0)
|
#define CHECK_THROWS( ... ) (void)(0)
|
||||||
#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0)
|
||||||
#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
#define CHECK_THROWS_WITH( expr, matcher ) (void)(0)
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0)
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
#define CHECK_NOTHROW( ... ) (void)(0)
|
#define CHECK_NOTHROW( ... ) (void)(0)
|
||||||
|
|
||||||
|
|
||||||
#if !defined(CATCH_CONFIG_DISABLE_MATCHERS)
|
|
||||||
#define CHECK_THAT( arg, matcher ) (void)(0)
|
#define CHECK_THAT( arg, matcher ) (void)(0)
|
||||||
|
|
||||||
#define REQUIRE_THAT( arg, matcher ) (void)(0)
|
#define REQUIRE_THAT( arg, matcher ) (void)(0)
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
#define INFO( msg ) (void)(0)
|
#define INFO( msg ) (void)(0)
|
||||||
#define UNSCOPED_INFO( msg ) (void)(0)
|
#define UNSCOPED_INFO( msg ) (void)(0)
|
||||||
|
@ -25,6 +25,7 @@ namespace Catch {
|
|||||||
struct IConfig;
|
struct IConfig;
|
||||||
|
|
||||||
class TestSpec {
|
class TestSpec {
|
||||||
|
|
||||||
class Pattern {
|
class Pattern {
|
||||||
public:
|
public:
|
||||||
explicit Pattern( std::string const& name );
|
explicit Pattern( std::string const& name );
|
||||||
@ -34,7 +35,6 @@ namespace Catch {
|
|||||||
private:
|
private:
|
||||||
std::string const m_name;
|
std::string const m_name;
|
||||||
};
|
};
|
||||||
using PatternPtr = std::shared_ptr<Pattern>;
|
|
||||||
|
|
||||||
class NamePattern : public Pattern {
|
class NamePattern : public Pattern {
|
||||||
public:
|
public:
|
||||||
@ -53,8 +53,8 @@ namespace Catch {
|
|||||||
};
|
};
|
||||||
|
|
||||||
struct Filter {
|
struct Filter {
|
||||||
std::vector<PatternPtr> m_required;
|
std::vector<std::unique_ptr<Pattern>> m_required;
|
||||||
std::vector<PatternPtr> m_forbidden;
|
std::vector<std::unique_ptr<Pattern>> m_forbidden;
|
||||||
|
|
||||||
bool matches( TestCaseInfo const& testCase ) const;
|
bool matches( TestCaseInfo const& testCase ) const;
|
||||||
std::string name() const;
|
std::string name() const;
|
||||||
|
@ -32,7 +32,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
TestSpec TestSpecParser::testSpec() {
|
TestSpec TestSpecParser::testSpec() {
|
||||||
addFilter();
|
addFilter();
|
||||||
return m_testSpec;
|
return std::move(m_testSpec);
|
||||||
}
|
}
|
||||||
bool TestSpecParser::visitChar( char c ) {
|
bool TestSpecParser::visitChar( char c ) {
|
||||||
if( (m_mode != EscapedName) && (c == '\\') ) {
|
if( (m_mode != EscapedName) && (c == '\\') ) {
|
||||||
@ -148,7 +148,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void TestSpecParser::addFilter() {
|
void TestSpecParser::addFilter() {
|
||||||
if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) {
|
if( !m_currentFilter.m_required.empty() || !m_currentFilter.m_forbidden.empty() ) {
|
||||||
m_testSpec.m_filters.push_back( m_currentFilter );
|
m_testSpec.m_filters.push_back( std::move(m_currentFilter) );
|
||||||
m_currentFilter = TestSpec::Filter();
|
m_currentFilter = TestSpec::Filter();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -65,11 +65,10 @@ namespace Catch {
|
|||||||
token = token.substr( 8 );
|
token = token.substr( 8 );
|
||||||
}
|
}
|
||||||
if( !token.empty() ) {
|
if( !token.empty() ) {
|
||||||
TestSpec::PatternPtr pattern = std::make_shared<T>( token, m_substring );
|
|
||||||
if (m_exclusion) {
|
if (m_exclusion) {
|
||||||
m_currentFilter.m_forbidden.push_back(pattern);
|
m_currentFilter.m_forbidden.emplace_back(std::make_unique<T>(token, m_substring));
|
||||||
} else {
|
} else {
|
||||||
m_currentFilter.m_required.push_back(pattern);
|
m_currentFilter.m_required.emplace_back(std::make_unique<T>(token, m_substring));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
m_substring.clear();
|
m_substring.clear();
|
||||||
|
@ -37,7 +37,7 @@ namespace Catch {
|
|||||||
}
|
}
|
||||||
|
|
||||||
Version const& libraryVersion() {
|
Version const& libraryVersion() {
|
||||||
static Version version( 2, 10, 2, "", 0 );
|
static Version version( 3, 0, 0, "preview", 2 );
|
||||||
return version;
|
return version;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,8 @@
|
|||||||
#ifndef TWOBLUECUBES_CATCH_VERSION_MACROS_HPP_INCLUDED
|
#ifndef TWOBLUECUBES_CATCH_VERSION_MACROS_HPP_INCLUDED
|
||||||
#define TWOBLUECUBES_CATCH_VERSION_MACROS_HPP_INCLUDED
|
#define TWOBLUECUBES_CATCH_VERSION_MACROS_HPP_INCLUDED
|
||||||
|
|
||||||
#define CATCH_VERSION_MAJOR 2
|
#define CATCH_VERSION_MAJOR 3
|
||||||
#define CATCH_VERSION_MINOR 10
|
#define CATCH_VERSION_MINOR 0
|
||||||
#define CATCH_VERSION_PATCH 2
|
#define CATCH_VERSION_PATCH 0
|
||||||
|
|
||||||
#endif // TWOBLUECUBES_CATCH_VERSION_MACROS_HPP_INCLUDED
|
#endif // TWOBLUECUBES_CATCH_VERSION_MACROS_HPP_INCLUDED
|
||||||
|
@ -81,7 +81,7 @@ namespace Catch {
|
|||||||
// It can optionally be overridden in the derived class.
|
// It can optionally be overridden in the derived class.
|
||||||
}
|
}
|
||||||
|
|
||||||
IConfigPtr m_config;
|
IConfig const* m_config;
|
||||||
std::ostream& stream;
|
std::ostream& stream;
|
||||||
|
|
||||||
LazyStat<TestRunInfo> currentTestRunInfo;
|
LazyStat<TestRunInfo> currentTestRunInfo;
|
||||||
@ -227,7 +227,7 @@ namespace Catch {
|
|||||||
|
|
||||||
void skipTest(TestCaseInfo const&) override {}
|
void skipTest(TestCaseInfo const&) override {}
|
||||||
|
|
||||||
IConfigPtr m_config;
|
IConfig const* m_config;
|
||||||
std::ostream& stream;
|
std::ostream& stream;
|
||||||
std::vector<AssertionStats> m_assertions;
|
std::vector<AssertionStats> m_assertions;
|
||||||
std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;
|
std::vector<std::vector<std::shared_ptr<SectionNode>>> m_sections;
|
||||||
|
@ -4,7 +4,6 @@ yet:
|
|||||||
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
CATCH_CONFIG_COUNTER // Use __COUNTER__ to generate unique names for test cases
|
||||||
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
CATCH_CONFIG_WINDOWS_SEH // Enable SEH handling on Windows
|
||||||
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
|
CATCH_CONFIG_FAST_COMPILE // Sacrifices some (rather minor) features for compilation speed
|
||||||
CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit
|
|
||||||
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals
|
||||||
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap
|
||||||
CATCH_CONFIG_DEFAULT_REPORTER
|
CATCH_CONFIG_DEFAULT_REPORTER
|
||||||
|
@ -286,9 +286,7 @@ TEST_CASE( "Parse test names and tags" ) {
|
|||||||
|
|
||||||
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
|
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
using namespace Catch::Matchers;
|
using namespace Catch::Matchers;
|
||||||
#endif
|
|
||||||
|
|
||||||
Catch::ConfigData config;
|
Catch::ConfigData config;
|
||||||
auto cli = Catch::makeCommandLineParser(config);
|
auto cli = Catch::makeCommandLineParser(config);
|
||||||
@ -367,9 +365,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
auto result = cli.parse({"test", "--reporter", "unsupported"});
|
auto result = cli.parse({"test", "--reporter", "unsupported"});
|
||||||
CHECK(!result);
|
CHECK(!result);
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
REQUIRE_THAT(result.errorMessage(), Contains("Unrecognized reporter"));
|
REQUIRE_THAT(result.errorMessage(), Contains("Unrecognized reporter"));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -401,10 +397,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
SECTION("-x must be numeric") {
|
SECTION("-x must be numeric") {
|
||||||
auto result = cli.parse({"test", "-x", "oops"});
|
auto result = cli.parse({"test", "-x", "oops"});
|
||||||
CHECK(!result);
|
CHECK(!result);
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops"));
|
REQUIRE_THAT(result.errorMessage(), Contains("convert") && Contains("oops"));
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -476,9 +469,7 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
|
|||||||
SECTION( "error" ) {
|
SECTION( "error" ) {
|
||||||
auto result = cli.parse({"test", "--use-colour", "wrong"});
|
auto result = cli.parse({"test", "--use-colour", "wrong"});
|
||||||
CHECK( !result );
|
CHECK( !result );
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) );
|
CHECK_THAT( result.errorMessage(), Contains( "colour mode must be one of" ) );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,14 +22,12 @@ TEST_CASE( "Tag alias can be registered against tag patterns" ) {
|
|||||||
FAIL( "expected exception" );
|
FAIL( "expected exception" );
|
||||||
}
|
}
|
||||||
catch( std::exception& ex ) {
|
catch( std::exception& ex ) {
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
std::string what = ex.what();
|
std::string what = ex.what();
|
||||||
using namespace Catch::Matchers;
|
using namespace Catch::Matchers;
|
||||||
CHECK_THAT( what, Contains( "[@zzz]" ) );
|
CHECK_THAT( what, Contains( "[@zzz]" ) );
|
||||||
CHECK_THAT( what, Contains( "file" ) );
|
CHECK_THAT( what, Contains( "file" ) );
|
||||||
CHECK_THAT( what, Contains( "2" ) );
|
CHECK_THAT( what, Contains( "2" ) );
|
||||||
CHECK_THAT( what, Contains( "10" ) );
|
CHECK_THAT( what, Contains( "10" ) );
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,9 +79,7 @@ namespace { namespace CompilationTests {
|
|||||||
REQUIRE_THROWS(throws_int(true));
|
REQUIRE_THROWS(throws_int(true));
|
||||||
CHECK_THROWS_AS(throws_int(true), int);
|
CHECK_THROWS_AS(throws_int(true), int);
|
||||||
REQUIRE_NOTHROW(throws_int(false));
|
REQUIRE_NOTHROW(throws_int(false));
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
REQUIRE_THAT("aaa", Catch::EndsWith("aaa"));
|
REQUIRE_THAT("aaa", Catch::EndsWith("aaa"));
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,8 +162,6 @@ TEST_CASE("thrown std::strings are translated", "[.][failing][!throws]") {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
TEST_CASE( "Exception messages can be tested for", "[!throws]" ) {
|
TEST_CASE( "Exception messages can be tested for", "[!throws]" ) {
|
||||||
using namespace Catch::Matchers;
|
using namespace Catch::Matchers;
|
||||||
SECTION( "exact match" )
|
SECTION( "exact match" )
|
||||||
@ -178,8 +176,6 @@ TEST_CASE( "Exception messages can be tested for", "[!throws]" ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
TEST_CASE( "Mismatching exception messages failing the test", "[.][failing][!throws]" ) {
|
TEST_CASE( "Mismatching exception messages failing the test", "[.][failing][!throws]" ) {
|
||||||
REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
|
REQUIRE_THROWS_WITH( thisThrows(), "expected exception" );
|
||||||
REQUIRE_THROWS_WITH( thisThrows(), "should fail" );
|
REQUIRE_THROWS_WITH( thisThrows(), "should fail" );
|
||||||
|
@ -22,8 +22,6 @@
|
|||||||
|
|
||||||
namespace { namespace MatchersTests {
|
namespace { namespace MatchersTests {
|
||||||
|
|
||||||
#ifndef CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
#ifndef MATCHERS_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
|
#ifndef MATCHERS_TEST_HELPERS_INCLUDED // Don't compile this more than once per TU
|
||||||
#define MATCHERS_TEST_HELPERS_INCLUDED
|
#define MATCHERS_TEST_HELPERS_INCLUDED
|
||||||
|
|
||||||
@ -558,8 +556,6 @@ namespace { namespace MatchersTests {
|
|||||||
|
|
||||||
} } // namespace MatchersTests
|
} } // namespace MatchersTests
|
||||||
|
|
||||||
#endif // CATCH_CONFIG_DISABLE_MATCHERS
|
|
||||||
|
|
||||||
#ifdef __clang__
|
#ifdef __clang__
|
||||||
#pragma clang diagnostic pop
|
#pragma clang diagnostic pop
|
||||||
#endif
|
#endif
|
||||||
|
@ -31,7 +31,7 @@ hexParser = re.compile(r'\b(0[xX][0-9a-fA-F]+)\b')
|
|||||||
durationsParser = re.compile(r' time="[0-9]*\.[0-9]*"')
|
durationsParser = re.compile(r' time="[0-9]*\.[0-9]*"')
|
||||||
sonarqubeDurationParser = re.compile(r' duration="[0-9]+"')
|
sonarqubeDurationParser = re.compile(r' duration="[0-9]+"')
|
||||||
timestampsParser = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z')
|
timestampsParser = re.compile(r'\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}Z')
|
||||||
versionParser = re.compile(r'Catch v[0-9]+\.[0-9]+\.[0-9]+(-develop\.[0-9]+)?')
|
versionParser = re.compile(r'Catch v[0-9]+\.[0-9]+\.[0-9]+(-\w*\.[0-9]+)?')
|
||||||
nullParser = re.compile(r'\b(__null|nullptr)\b')
|
nullParser = re.compile(r'\b(__null|nullptr)\b')
|
||||||
exeNameParser = re.compile(r'''
|
exeNameParser = re.compile(r'''
|
||||||
\b
|
\b
|
||||||
|
Loading…
x
Reference in New Issue
Block a user