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
This commit is contained in:
Martin Hořeňovský
2017-08-09 15:28:40 +02:00
parent 92d714ee12
commit 7e4038d848
8 changed files with 116 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesspanner>
<testsuite name="<exe-name>" errors="13" failures="78" tests="971" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="13" failures="81" tests="974" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testcase classname="global" name="# A test name that starts with a #" time="{duration}"/>
<testcase classname="#748 - captures with unexpected exceptions" name="outside assertions" time="{duration}">
<error type="TEST_CASE">
@@ -475,6 +475,13 @@ A string sent directly to stderr
</system-err>
</testcase>
<testcase classname="global" name="Some simple comparisons between doubles" time="{duration}"/>
<testcase classname="Standard error is reported and redirected" name="Interleaved writes to cerr and clog" time="{duration}">
<system-err>
Write to std::cerr
Write to std::clog
Interleaved writes to error streams
</system-err>
</testcase>
<testcase classname="Standard output from all sections is reported" name="two" time="{duration}">
<system-out>
Message from section one
@@ -750,6 +757,9 @@ hello
</system-out>
<system-err>
A string sent directly to stderr
Write to std::cerr
Write to std::clog
Interleaved writes to error streams
</system-err>
</testsuite>
</testsuites>