From c086746cc9b4701f19b1b9f2239fd9aba18223bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Sun, 3 May 2020 19:21:58 +0200 Subject: [PATCH] Use main-as-static-lib in ExtraTests --- 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 // This won't provide full coverage, but it might be worth checking // the other branch as well + #include #include #include 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 #include #include 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 #include 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 #include 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 -#include #include TEST_CASE("Catch2 did survive compilation with windows.h", "[compile-test]") {