Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Use main-as-static-lib in ExtraTests

Commit
c086746cc9b4701f19b1b9f2239fd9aba18223bd
Author
Martin Hořeňovský ·
Parents
0c223bb751ce

Files · Download .tar.gz

Changes

 tests/ExtraTests/CMakeLists.txt                 | 10 +++++-----
 tests/ExtraTests/X01-PrefixedMacros.cpp         |  5 ++---
 tests/ExtraTests/X02-DisabledMacros.cpp         |  1 -
 tests/ExtraTests/X10-FallbackStringifier.cpp    |  1 -
 tests/ExtraTests/X11-DisableStringification.cpp |  1 -
 tests/ExtraTests/X90-WindowsHeaderInclusion.cpp |  1 -
 6 files changed, 7 insertions(+), 12 deletions(-)

diff --git a/tests/ExtraTests/CMakeLists.txt b/tests/ExtraTests/CMakeLists.txt
index 8f391e48..4946d842 100644
--- a/tests/ExtraTests/CMakeLists.txt
+++ b/tests/ExtraTests/CMakeLists.txt
@@ -15,7 +15,7 @@ add_executable(PrefixedMacros ${TESTS_DIR}/X01-PrefixedMacros.cpp)
 target_compile_definitions( PrefixedMacros PRIVATE CATCH_CONFIG_PREFIX_ALL CATCH_CONFIG_RUNTIME_STATIC_REQUIRE )
 # Macro configuration does not touch the compiled parts, so we can link
 # it against the main library
-target_link_libraries( PrefixedMacros Catch2 )
+target_link_libraries( PrefixedMacros Catch2WithMain )
 
 add_test(NAME CATCH_CONFIG_PREFIX_ALL COMMAND PrefixedMacros -s)
 set_tests_properties(
@@ -33,7 +33,7 @@ add_executable(DisabledMacros ${TESTS_DIR}/X02-DisabledMacros.cpp)
 target_compile_definitions( DisabledMacros PRIVATE CATCH_CONFIG_DISABLE )
 # Macro configuration does not touch the compiled parts, so we can link
 # it against the main library
-target_link_libraries( DisabledMacros Catch2 )
+target_link_libraries( DisabledMacros Catch2WithMain )
 
 add_test(NAME CATCH_CONFIG_DISABLE-1 COMMAND DisabledMacros -s)
 set_tests_properties(
@@ -97,7 +97,7 @@ set_tests_properties(
 
 add_executable(FallbackStringifier ${TESTS_DIR}/X10-FallbackStringifier.cpp)
 target_compile_definitions( FallbackStringifier PRIVATE CATCH_CONFIG_FALLBACK_STRINGIFIER=fallbackStringifier )
-target_link_libraries( FallbackStringifier Catch2 )
+target_link_libraries( FallbackStringifier Catch2WithMain )
 
 add_test(NAME FallbackStringifier COMMAND FallbackStringifier -r compact -s)
 set_tests_properties(
@@ -109,7 +109,7 @@ set_tests_properties(
 
 add_executable(DisableStringification ${TESTS_DIR}/X11-DisableStringification.cpp)
 target_compile_definitions( DisableStringification PRIVATE CATCH_CONFIG_DISABLE_STRINGIFICATION )
-target_link_libraries(DisableStringification Catch2)
+target_link_libraries(DisableStringification Catch2WithMain)
 add_test(NAME CATCH_CONFIG_DISABLE_STRINGIFICATION COMMAND DisableStringification -r compact -s)
 set_tests_properties(
     CATCH_CONFIG_DISABLE_STRINGIFICATION
@@ -126,7 +126,7 @@ if (MSVC)
     set_property( TARGET WindowsHeader PROPERTY CXX_STANDARD 14 )
     set_property( TARGET WindowsHeader PROPERTY CXX_STANDARD_REQUIRED ON )
     set_property( TARGET WindowsHeader PROPERTY CXX_EXTENSIONS OFF )
-    target_link_libraries( WindowsHeader Catch2 )
+    target_link_libraries( WindowsHeader Catch2WithMain )
     add_test(NAME WindowsHeader COMMAND WindowsHeader -r compact)
     list(APPEND CATCH_WARNING_TARGETS ${EXTRA_TEST_BINARIES} WindowsHeader)
 endif()
diff --git a/tests/ExtraTests/X01-PrefixedMacros.cpp b/tests/ExtraTests/X01-PrefixedMacros.cpp
index 3fc23b09..43452d76 100644
--- a/tests/ExtraTests/X01-PrefixedMacros.cpp
+++ b/tests/ExtraTests/X01-PrefixedMacros.cpp
@@ -1,9 +1,8 @@
-// X11-DisableStringification.cpp
+// X01-DisableStringification.cpp
 // Test that Catch's prefixed macros compile and run properly.
-
-#include <catch2/internal/catch_default_main.hpp>
 // This won't provide full coverage, but it might be worth checking
 // the other branch as well
+
 #include <catch2/catch_test_macros.hpp>
 #include <catch2/matchers/catch_matchers_predicate.hpp>
 #include <catch2/matchers/catch_matchers_string.hpp>
diff --git a/tests/ExtraTests/X02-DisabledMacros.cpp b/tests/ExtraTests/X02-DisabledMacros.cpp
index 10d5c697..c2d997c9 100644
--- a/tests/ExtraTests/X02-DisabledMacros.cpp
+++ b/tests/ExtraTests/X02-DisabledMacros.cpp
@@ -2,7 +2,6 @@
 // Test that CATCH_CONFIG_DISABLE turns off TEST_CASE autoregistration
 // and expressions in assertion macros are not run.
 
-#include <catch2/internal/catch_default_main.hpp>
 #include <catch2/catch_test_macros.hpp>
 
 #include <iostream>
diff --git a/tests/ExtraTests/X10-FallbackStringifier.cpp b/tests/ExtraTests/X10-FallbackStringifier.cpp
index 900d23e7..af31047b 100644
--- a/tests/ExtraTests/X10-FallbackStringifier.cpp
+++ b/tests/ExtraTests/X10-FallbackStringifier.cpp
@@ -9,7 +9,6 @@ std::string fallbackStringifier(T const&) {
     return "{ !!! }";
 }
 
-#include <catch2/internal/catch_default_main.hpp>
 #include <catch2/catch_test_macros.hpp>
 
 struct foo {
diff --git a/tests/ExtraTests/X11-DisableStringification.cpp b/tests/ExtraTests/X11-DisableStringification.cpp
index 5cd32f12..b127d246 100644
--- a/tests/ExtraTests/X11-DisableStringification.cpp
+++ b/tests/ExtraTests/X11-DisableStringification.cpp
@@ -4,7 +4,6 @@
 // and preprocessor token pasting. In other words, hopefully this test
 // will be deleted soon :-)
 
-#include <catch2/internal/catch_default_main.hpp>
 #include <catch2/catch_test_macros.hpp>
 
 namespace {
diff --git a/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp b/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp
index 454b0a8d..307e877f 100644
--- a/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp
+++ b/tests/ExtraTests/X90-WindowsHeaderInclusion.cpp
@@ -4,7 +4,6 @@
 // wrong.
 
 #include <windows.h>
-#include <catch2/internal/catch_default_main.hpp>
 #include <catch2/catch_test_macros.hpp>
 
 TEST_CASE("Catch2 did survive compilation with windows.h", "[compile-test]") {