Use main-as-static-lib in ExtraTests

This commit is contained in:
Martin Hořeňovský 2020-05-03 19:21:58 +02:00
parent 0c223bb751
commit c086746cc9
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
6 changed files with 7 additions and 12 deletions

View File

@ -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()

View File

@ -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>

View File

@ -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>

View File

@ -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 {

View File

@ -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 {

View File

@ -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]") {