diff --git a/projects/ExtraTests/CMakeLists.txt b/projects/ExtraTests/CMakeLists.txt index e78a4d49..cf8b6b25 100644 --- a/projects/ExtraTests/CMakeLists.txt +++ b/projects/ExtraTests/CMakeLists.txt @@ -17,13 +17,37 @@ set( SINGLE_INCLUDE_PATH ${CATCH_DIR}/single_include ) add_executable(FallbackStringifier ${TESTS_DIR}/X10-FallbackStringifier.cpp) -add_test(NAME FallbackStringifier COMMAND FallbackStringifier -r compact -s) -set_tests_properties(FallbackStringifier PROPERTIES PASS_REGULAR_EXPRESSION "foo{} for: { !!! }") - - -set_property( TARGET FallbackStringifier PROPERTY CXX_STANDARD 11 ) -set_property( TARGET FallbackStringifier PROPERTY CXX_STANDARD_REQUIRED ON ) -set_property( TARGET FallbackStringifier PROPERTY CXX_EXTENSIONS OFF ) - -target_include_directories( FallbackStringifier PRIVATE ${SINGLE_INCLUDE_PATH} ) target_compile_definitions( FallbackStringifier PRIVATE CATCH_CONFIG_FALLBACK_STRINGIFIER=fallbackStringifier ) + +add_test(NAME FallbackStringifier COMMAND FallbackStringifier -r compact -s) +set_tests_properties( + FallbackStringifier + PROPERTIES + PASS_REGULAR_EXPRESSION "foo{} for: { !!! }" +) + + +add_executable(DisableStringification ${TESTS_DIR}/X11-DisableStringification.cpp) +target_compile_definitions( DisableStringification PRIVATE CATCH_CONFIG_DISABLE_STRINGIFICATION ) +add_test(NAME CATCH_CONFIG_DISABLE_STRINGIFICATION COMMAND DisableStringification -r compact -s) +set_tests_properties( + CATCH_CONFIG_DISABLE_STRINGIFICATION + PROPERTIES + PASS_REGULAR_EXPRESSION "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" + FAIL_REGULAR_EXPRESSION "Hidden{} == Hidden{}" +) + + +set( EXTRA_TEST_BINARIES + FallbackStringifier + DisableStringification +) + +# Shared config +foreach( test ${EXTRA_TEST_BINARIES} ) + set_property( TARGET ${test} PROPERTY CXX_STANDARD 11 ) + set_property( TARGET ${test} PROPERTY CXX_STANDARD_REQUIRED ON ) + set_property( TARGET ${test} PROPERTY CXX_EXTENSIONS OFF ) + target_include_directories( ${test} PRIVATE ${SINGLE_INCLUDE_PATH} ) +endforeach() + diff --git a/projects/ExtraTests/ToDo.txt b/projects/ExtraTests/ToDo.txt index 0f878bd1..ed5495bd 100644 --- a/projects/ExtraTests/ToDo.txt +++ b/projects/ExtraTests/ToDo.txt @@ -7,6 +7,5 @@ yet: CATCH_CONFIG_DISABLE_MATCHERS // Do not compile Matchers in this compilation unit CATCH_CONFIG_POSIX_SIGNALS // Enable handling POSIX signals CATCH_CONFIG_WINDOWS_CRTDBG // Enable leak checking using Windows's CRT Debug Heap - CATCH_CONFIG_DISABLE_STRINGIFICATION // Disable stringifying the original expression CATCH_CONFIG_DISABLE // Disables assertions and test case registration CATCH_CONFIG_DEFAULT_REPORTER diff --git a/projects/ExtraTests/X11-DisableStringification.cpp b/projects/ExtraTests/X11-DisableStringification.cpp new file mode 100644 index 00000000..7a93f6e2 --- /dev/null +++ b/projects/ExtraTests/X11-DisableStringification.cpp @@ -0,0 +1,16 @@ +// X11-DisableStringification.cpp +// Test that stringification of original expression can be disabled +// this is a workaround for VS 2017 issue with Raw String literal +// and preprocessor token pasting. In other words, hopefully this test +// will be deleted soon :-) + +#define CATCH_CONFIG_MAIN +#include + +struct Hidden {}; + +bool operator==(Hidden, Hidden) { return true; } + +TEST_CASE("DisableStringification") { + REQUIRE( Hidden{} == Hidden{} ); +}