mirror of
https://github.com/catchorg/Catch2.git
synced 2024-12-26 12:43:31 +01:00
Add test for CATCH_CONFIG_DISABLE_STRINGIFICATION
This commit is contained in:
parent
38e1731f69
commit
f3972f0695
@ -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()
|
||||
|
||||
|
@ -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
|
||||
|
16
projects/ExtraTests/X11-DisableStringification.cpp
Normal file
16
projects/ExtraTests/X11-DisableStringification.cpp
Normal file
@ -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 <catch2/catch.hpp>
|
||||
|
||||
struct Hidden {};
|
||||
|
||||
bool operator==(Hidden, Hidden) { return true; }
|
||||
|
||||
TEST_CASE("DisableStringification") {
|
||||
REQUIRE( Hidden{} == Hidden{} );
|
||||
}
|
Loading…
Reference in New Issue
Block a user