diff options
| author | Martin Hořeňovský | 2019-12-08 20:57:55 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2019-12-08 20:58:52 +0100 |
| commit | 29b441949cc09f59a867972cbbac4b88f1a10843 (patch) | |
| tree | 74c279661da73ae71338623f83b4d666faf390ed /examples | |
| parent | 70ef2f7f12c2c62714a2e926679172142ea150ff (diff) | |
| download | catch3-29b441949cc09f59a867972cbbac4b88f1a10843.tar.gz | |
Port the last example
Diffstat (limited to 'examples')
| -rw-r--r-- | examples/231-Cfg-OutputStreams.cpp | 6 | ||||
| -rw-r--r-- | examples/CMakeLists.txt | 7 |
2 files changed, 9 insertions, 4 deletions
diff --git a/examples/231-Cfg-OutputStreams.cpp b/examples/231-Cfg-OutputStreams.cpp index 2f42c297..8753fcf6 100644 --- a/examples/231-Cfg-OutputStreams.cpp +++ b/examples/231-Cfg-OutputStreams.cpp @@ -6,10 +6,12 @@ // there is no important difference between having `std::cerr` buffered // or unbuffered. -#define CATCH_CONFIG_NOSTDOUT -#define CATCH_CONFIG_MAIN +#include <catch2/catch_default_main.hpp> + #include <catch2/catch.hpp> +#include <sstream> +#include <cstdio> class out_buff : public std::stringbuf { std::FILE* m_stream; diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 2fe5e688..b8612581 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -17,8 +17,11 @@ add_executable( 020-MultiFile 020-TestCase-2.cpp ) -# TODO: How to handle differently configured libraries? -# Needed in 231-Cfg-OutputStreams +add_executable(231-Cfg_OutputStreams + 231-Cfg-OutputStreams.cpp +) +StampOutLibrary(231-Cfg_OutputStreams) +target_compile_definitions(Catch2_231-Cfg_OutputStreams PUBLIC CATCH_CONFIG_NOSTDOUT) # These examples use the standard separate compilation set( SOURCES_IDIOMATIC_EXAMPLES |