From a57640c2c89042d7ecc2c5f87712b553c8e14612 Mon Sep 17 00:00:00 2001 From: Chris Thrasher Date: Wed, 22 Jun 2022 13:54:28 -0600 Subject: [PATCH] Require stringification for all tested types This ensures that if a printing function is not provided, compilation fails. This prevents problems where a header is accidentally removed that was previously providing an operator<< overload or prevents new tests from being added without print support for all directly tested types. --- test/CMakeLists.txt | 1 + test/Graphics/Rect.cpp | 1 - 2 files changed, 1 insertion(+), 1 deletion(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index df80dccf7..8c44ae205 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -9,6 +9,7 @@ add_library(sfml-test-main STATIC ) target_include_directories(sfml-test-main SYSTEM PUBLIC "${PROJECT_SOURCE_DIR}/extlibs/headers") target_include_directories(sfml-test-main PUBLIC TestUtilities) +target_compile_definitions(sfml-test-main PUBLIC DOCTEST_CONFIG_REQUIRE_STRINGIFICATION_FOR_ALL_USED_TYPES) target_link_libraries(sfml-test-main PUBLIC SFML::System) set_target_warnings(sfml-test-main) diff --git a/test/Graphics/Rect.cpp b/test/Graphics/Rect.cpp index 71319173a..ba6d78d89 100644 --- a/test/Graphics/Rect.cpp +++ b/test/Graphics/Rect.cpp @@ -78,7 +78,6 @@ TEST_CASE("sf::Rect class template - [graphics]") const sf::IntRect nonIntersectingRectangle({-5, -5}, {5, 5}); CHECK_FALSE(rectangle.findIntersection(nonIntersectingRectangle).has_value()); - CHECK_FALSE(rectangle.findIntersection(nonIntersectingRectangle)); } SUBCASE("getPosition()")