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
This commit is contained in:
Martin Hořeňovský 2017-08-17 20:21:06 +02:00
parent 0545de0a31
commit 24af32f378
4 changed files with 21 additions and 1 deletions

View File

@ -138,6 +138,7 @@ set(INTERNAL_HEADERS
${HEADER_DIR}/internal/catch_enforce.h ${HEADER_DIR}/internal/catch_enforce.h
${HEADER_DIR}/internal/catch_errno_guard.h ${HEADER_DIR}/internal/catch_errno_guard.h
${HEADER_DIR}/internal/catch_exception_translator_registry.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_fatal_condition.h
${HEADER_DIR}/internal/catch_impl.hpp ${HEADER_DIR}/internal/catch_impl.hpp
${HEADER_DIR}/internal/catch_interfaces_capture.h ${HEADER_DIR}/internal/catch_interfaces_capture.h

View File

@ -19,6 +19,7 @@
#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) #if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER)
# define CATCH_IMPL # define CATCH_IMPL
# define CATCH_CONFIG_EXTERNAL_INTERFACES
#endif #endif
#ifdef CATCH_IMPL #ifdef CATCH_IMPL
@ -52,6 +53,10 @@
#include "internal/catch_objc.hpp" #include "internal/catch_objc.hpp"
#endif #endif
#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES
#include "internal/catch_external_interfaces.h"
#endif
#ifdef CATCH_IMPL #ifdef CATCH_IMPL
#include "internal/catch_impl.hpp" #include "internal/catch_impl.hpp"
#endif #endif

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. * Created by Phil on 31/12/2010.
* Copyright 2010 Two Blue Cubes Ltd. All rights reserved. * Copyright 2010 Two Blue Cubes Ltd. All rights reserved.
@ -39,7 +40,7 @@ namespace Catch {
class ListenerFactory : public IReporterFactory { class ListenerFactory : public IReporterFactory {
virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { 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 { virtual std::string getDescription() const override {
return std::string(); return std::string();