Skip to content

Commit

Permalink
[catch] Package Catch test runner as a CMake object library for reuse
Browse files Browse the repository at this point in the history
  • Loading branch information
K-ballo committed Dec 31, 2017
1 parent 1c2857b commit 6ffbe3d
Show file tree
Hide file tree
Showing 25 changed files with 12 additions and 24 deletions.
4 changes: 3 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
# Distributed under the Boost Software License, Version 1.0. (See accompanying
# file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

add_library(Catch2 OBJECT catch.cpp)

set(_tests
apply
assign.conversion
Expand All @@ -30,7 +32,7 @@ set(_tests
rel.order
swap)
foreach (_test ${_tests})
add_executable(test.${_test} ${_test}.cpp)
add_executable(test.${_test} ${_test}.cpp $<TARGET_OBJECTS:Catch2>)
target_link_libraries(test.${_test} Eggs::Variant)

add_test(NAME test.${_test} COMMAND test.${_test})
Expand Down
1 change: 0 additions & 1 deletion test/apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using eggs::variants::detail::move;

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/assign.conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"
#include "dtor.hpp"
Expand Down
1 change: 0 additions & 1 deletion test/assign.copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using eggs::variants::detail::move;

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"
#include "dtor.hpp"
Expand Down
1 change: 0 additions & 1 deletion test/assign.emplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"
#include "dtor.hpp"
Expand Down
1 change: 0 additions & 1 deletion test/assign.move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using eggs::variants::detail::move;

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"
#include "dtor.hpp"
Expand Down
9 changes: 9 additions & 0 deletions test/catch.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Eggs.Variant
//
// Copyright Agustin K-ballo Berge, Fusion Fenix 2014-2017
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt)

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
1 change: 0 additions & 1 deletion test/cnstr.conversion.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/cnstr.copy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using eggs::variants::detail::move;

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/cnstr.default.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/cnstr.emplace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/cnstr.move.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

using eggs::variants::detail::move;

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/dtor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "dtor.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/elem.get.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

using eggs::variants::detail::move;

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/elem.get_if.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

#if EGGS_CXX11_HAS_SFINAE_FOR_EXPRESSIONS
Expand Down
1 change: 0 additions & 1 deletion test/helper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

template <class T, class = void>
Expand Down
1 change: 0 additions & 1 deletion test/in_place.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"

struct fun_index
Expand Down
1 change: 0 additions & 1 deletion test/obs.bool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/obs.target.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/obs.target_type.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/obs.which.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/rel.equality.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/rel.order.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"

Expand Down
1 change: 0 additions & 1 deletion test/swap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <eggs/variant/detail/config/prefix.hpp>

#define CATCH_CONFIG_MAIN
#include "catch.hpp"
#include "constexpr.hpp"
#include "dtor.hpp"
Expand Down

0 comments on commit 6ffbe3d

Please sign in to comment.