diff options
| author | Martin Hořeňovský | 2017-08-09 15:28:40 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2017-08-09 15:28:40 +0200 |
| commit | 7e4038d8488596e850a11c8fe236b59bca605444 (patch) | |
| tree | 4c4fdd5db9630ff68b5180bc00386f8e11709339 /projects/SelfTest/MessageTests.cpp | |
| parent | 92d714ee12714ab760eaaaf95d76237859a342d9 (diff) | |
| download | catch3-7e4038d8488596e850a11c8fe236b59bca605444.tar.gz | |
Capture std::clog writes and combine them with std::cerr writes (#989)
This also introduces Catch::clog() method to allow embedded targets
to override std::clog usage with their own stream (presumably null-sink),
similarly to how Catch::cout() and Catch::cerr() are used.
Fixes #989
Diffstat (limited to 'projects/SelfTest/MessageTests.cpp')
| -rw-r--r-- | projects/SelfTest/MessageTests.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/projects/SelfTest/MessageTests.cpp b/projects/SelfTest/MessageTests.cpp index bed9c137..047bead7 100644 --- a/projects/SelfTest/MessageTests.cpp +++ b/projects/SelfTest/MessageTests.cpp @@ -99,6 +99,23 @@ TEST_CASE( "Standard output from all sections is reported", "[messages][.]" ) } } +TEST_CASE( "Standard error is reported and redirected", "[messages][.]" ) { + SECTION( "std::cerr" ) { + std::cerr << "Write to std::cerr" << std::endl; + } + SECTION( "std::clog" ) { + std::clog << "Write to std::clog" << std::endl; + } + SECTION( "Interleaved writes to cerr and clog" ) { + std::cerr << "Inter"; + std::clog << "leaved"; + std::cerr << ' '; + std::clog << "writes"; + std::cerr << " to error"; + std::clog << " streams\n"; + } +} + TEST_CASE( "SCOPED_INFO is reset for each loop", "[messages][failing][.]" ) { for( int i=0; i<100; i++ ) |