From 06f74a0f8e505a08fff58e63beeb88569d8629d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Ho=C5=99e=C5=88ovsk=C3=BD?= Date: Mon, 7 Mar 2022 10:42:26 +0100 Subject: [PATCH] Add %stderr and %stdout as recognized magic stream names --- src/catch2/internal/catch_stream.cpp | 28 ++++++++++++--- .../Baselines/automake.sw.approved.txt | 2 ++ .../Baselines/automake.sw.multi.approved.txt | 2 ++ .../Baselines/compact.sw.approved.txt | 3 ++ .../Baselines/compact.sw.multi.approved.txt | 3 ++ .../Baselines/console.std.approved.txt | 4 +-- .../Baselines/console.sw.approved.txt | 29 ++++++++++++++-- .../Baselines/console.sw.multi.approved.txt | 29 ++++++++++++++-- .../SelfTest/Baselines/junit.sw.approved.txt | 4 ++- .../Baselines/junit.sw.multi.approved.txt | 4 ++- .../Baselines/sonarqube.sw.approved.txt | 2 ++ .../Baselines/sonarqube.sw.multi.approved.txt | 2 ++ tests/SelfTest/Baselines/tap.sw.approved.txt | 8 ++++- .../Baselines/tap.sw.multi.approved.txt | 8 ++++- .../Baselines/teamcity.sw.approved.txt | 4 +++ .../Baselines/teamcity.sw.multi.approved.txt | 4 +++ tests/SelfTest/Baselines/xml.sw.approved.txt | 34 +++++++++++++++++-- .../Baselines/xml.sw.multi.approved.txt | 34 +++++++++++++++++-- .../IntrospectiveTests/Stream.tests.cpp | 9 +++++ 19 files changed, 194 insertions(+), 19 deletions(-) diff --git a/src/catch2/internal/catch_stream.cpp b/src/catch2/internal/catch_stream.cpp index 5ce6e255..a5aecf8e 100644 --- a/src/catch2/internal/catch_stream.cpp +++ b/src/catch2/internal/catch_stream.cpp @@ -102,6 +102,20 @@ namespace Detail { bool isStdout() const override { return true; } }; + class CerrStream : public IStream { + mutable std::ostream m_os; + + public: + // Store the streambuf from cerr up-front because + // cout may get redirected when running tests + CerrStream(): m_os( Catch::cerr().rdbuf() ) {} + ~CerrStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + bool isStdout() const override { return true; } + }; + /////////////////////////////////////////////////////////////////////////// class DebugOutStream : public IStream { @@ -128,14 +142,18 @@ namespace Detail { if ( filename.empty() || filename == "-" ) { return Detail::make_unique(); } - else if( filename[0] == '%' ) { - if( filename == "%debug" ) + if( filename[0] == '%' ) { + if ( filename == "%debug" ) { return Detail::make_unique(); - else + } else if ( filename == "%stderr" ) { + return Detail::make_unique(); + } else if ( filename == "%stdout" ) { + return Detail::make_unique(); + } else { CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' ); + } } - else - return Detail::make_unique( filename ); + return Detail::make_unique( filename ); } diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index bfeb3da7..f9ab0b77 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -337,6 +337,7 @@ loose text artifact :test-result: FAIL prints unscoped info only for the first assertion :test-result: PASS random SECTION tests :test-result: PASS replaceInPlace +:test-result: PASS request an unknown %-starting stream fails :test-result: PASS resolution :test-result: PASS run_for_at_least, chronometer :test-result: PASS run_for_at_least, int @@ -352,6 +353,7 @@ loose text artifact :test-result: PASS std::pair -> toString :test-result: PASS std::set is convertible string :test-result: PASS std::vector > -> toString +:test-result: PASS stdout and stderr streams have %-starting name :test-result: PASS stringify ranges :test-result: PASS stringify( has_maker ) :test-result: PASS stringify( has_maker_and_operator ) diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt index a4070375..f9a6431f 100644 --- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt @@ -329,6 +329,7 @@ :test-result: FAIL prints unscoped info only for the first assertion :test-result: PASS random SECTION tests :test-result: PASS replaceInPlace +:test-result: PASS request an unknown %-starting stream fails :test-result: PASS resolution :test-result: PASS run_for_at_least, chronometer :test-result: PASS run_for_at_least, int @@ -344,6 +345,7 @@ :test-result: PASS std::pair -> toString :test-result: PASS std::set is convertible string :test-result: PASS std::vector > -> toString +:test-result: PASS stdout and stderr streams have %-starting name :test-result: PASS stringify ranges :test-result: PASS stringify( has_maker ) :test-result: PASS stringify( has_maker_and_operator ) diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index ea0ba61a..235f58ed 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -2309,6 +2309,7 @@ StringManip.tests.cpp:: passed: !(Catch::replaceInPlace(letters, "x StringManip.tests.cpp:: passed: letters == letters for: "abcdefcg" == "abcdefcg" StringManip.tests.cpp:: passed: Catch::replaceInPlace(s, "'", "|'") for: true StringManip.tests.cpp:: passed: s == "didn|'t" for: "didn|'t" == "didn|'t" +Stream.tests.cpp:: passed: Catch::makeStream( "%somestream" ) InternalBenchmark.tests.cpp:: passed: res.size() == count for: 10 == 10 InternalBenchmark.tests.cpp:: passed: res[i] == rate for: 1000.0 == 1000 (0x) InternalBenchmark.tests.cpp:: passed: res[i] == rate for: 1000.0 == 1000 (0x) @@ -2367,6 +2368,8 @@ ToStringGeneral.tests.cpp:: passed: Catch::Detail::stringify( set ) ToStringPair.tests.cpp:: passed: ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }" == "{ { "green", 55 } }" +Stream.tests.cpp:: passed: Catch::makeStream( "%stderr" )->isStdout() for: true +Stream.tests.cpp:: passed: Catch::makeStream( "%stdout" )->isStdout() for: true ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt index 4de9e7eb..f364a55a 100644 --- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt @@ -2301,6 +2301,7 @@ StringManip.tests.cpp:: passed: !(Catch::replaceInPlace(letters, "x StringManip.tests.cpp:: passed: letters == letters for: "abcdefcg" == "abcdefcg" StringManip.tests.cpp:: passed: Catch::replaceInPlace(s, "'", "|'") for: true StringManip.tests.cpp:: passed: s == "didn|'t" for: "didn|'t" == "didn|'t" +Stream.tests.cpp:: passed: Catch::makeStream( "%somestream" ) InternalBenchmark.tests.cpp:: passed: res.size() == count for: 10 == 10 InternalBenchmark.tests.cpp:: passed: res[i] == rate for: 1000.0 == 1000 (0x) InternalBenchmark.tests.cpp:: passed: res[i] == rate for: 1000.0 == 1000 (0x) @@ -2359,6 +2360,8 @@ ToStringGeneral.tests.cpp:: passed: Catch::Detail::stringify( set ) ToStringPair.tests.cpp:: passed: ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }" == "{ { "green", 55 } }" +Stream.tests.cpp:: passed: Catch::makeStream( "%stderr" )->isStdout() for: true +Stream.tests.cpp:: passed: Catch::makeStream( "%stdout" )->isStdout() for: true ToStringWhich.tests.cpp:: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 0b6a78bc..e37fd27c 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1395,6 +1395,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 383 | 307 passed | 69 failed | 7 failed as expected -assertions: 2213 | 2058 passed | 128 failed | 27 failed as expected +test cases: 385 | 309 passed | 69 failed | 7 failed as expected +assertions: 2216 | 2061 passed | 128 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 8eb882e3..aec59fb3 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -16447,6 +16447,15 @@ StringManip.tests.cpp:: PASSED: with expansion: "didn|'t" == "didn|'t" +------------------------------------------------------------------------------- +request an unknown %-starting stream fails +------------------------------------------------------------------------------- +Stream.tests.cpp: +............................................................................... + +Stream.tests.cpp:: PASSED: + REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ) + ------------------------------------------------------------------------------- resolution ------------------------------------------------------------------------------- @@ -16843,6 +16852,22 @@ with expansion: == "{ { "green", 55 } }" +------------------------------------------------------------------------------- +stdout and stderr streams have %-starting name +------------------------------------------------------------------------------- +Stream.tests.cpp: +............................................................................... + +Stream.tests.cpp:: PASSED: + REQUIRE( Catch::makeStream( "%stderr" )->isStdout() ) +with expansion: + true + +Stream.tests.cpp:: PASSED: + REQUIRE( Catch::makeStream( "%stdout" )->isStdout() ) +with expansion: + true + ------------------------------------------------------------------------------- stringify ranges ------------------------------------------------------------------------------- @@ -17786,6 +17811,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 383 | 293 passed | 83 failed | 7 failed as expected -assertions: 2228 | 2058 passed | 143 failed | 27 failed as expected +test cases: 385 | 295 passed | 83 failed | 7 failed as expected +assertions: 2231 | 2061 passed | 143 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt index 64ff619b..a9ccc32f 100644 --- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt @@ -16439,6 +16439,15 @@ StringManip.tests.cpp:: PASSED: with expansion: "didn|'t" == "didn|'t" +------------------------------------------------------------------------------- +request an unknown %-starting stream fails +------------------------------------------------------------------------------- +Stream.tests.cpp: +............................................................................... + +Stream.tests.cpp:: PASSED: + REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ) + ------------------------------------------------------------------------------- resolution ------------------------------------------------------------------------------- @@ -16835,6 +16844,22 @@ with expansion: == "{ { "green", 55 } }" +------------------------------------------------------------------------------- +stdout and stderr streams have %-starting name +------------------------------------------------------------------------------- +Stream.tests.cpp: +............................................................................... + +Stream.tests.cpp:: PASSED: + REQUIRE( Catch::makeStream( "%stderr" )->isStdout() ) +with expansion: + true + +Stream.tests.cpp:: PASSED: + REQUIRE( Catch::makeStream( "%stdout" )->isStdout() ) +with expansion: + true + ------------------------------------------------------------------------------- stringify ranges ------------------------------------------------------------------------------- @@ -17778,6 +17803,6 @@ Misc.tests.cpp: Misc.tests.cpp:: PASSED: =============================================================================== -test cases: 383 | 293 passed | 83 failed | 7 failed as expected -assertions: 2228 | 2058 passed | 143 failed | 27 failed as expected +test cases: 385 | 295 passed | 83 failed | 7 failed as expected +assertions: 2231 | 2061 passed | 143 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index e9db7259..84c3625e 100644 --- a/tests/SelfTest/Baselines/junit.sw.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.approved.txt @@ -1,7 +1,7 @@ - + @@ -1785,6 +1785,7 @@ Message.tests.cpp: + @@ -1837,6 +1838,7 @@ Message.tests.cpp: + diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt index 820be769..d1a41e13 100644 --- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt @@ -1,6 +1,6 @@ - + @@ -1784,6 +1784,7 @@ Message.tests.cpp: + @@ -1836,6 +1837,7 @@ Message.tests.cpp: + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index 0b5dfb42..9d6e859f 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -219,6 +219,8 @@ + + diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt index 27061535..a412dbc2 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt @@ -218,6 +218,8 @@ + + diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index f9f01296..bec30dda 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -4138,6 +4138,8 @@ ok {test-number} - letters == letters for: "abcdefcg" == "abcdefcg" ok {test-number} - Catch::replaceInPlace(s, "'", "|'") for: true # replaceInPlace ok {test-number} - s == "didn|'t" for: "didn|'t" == "didn|'t" +# request an unknown %-starting stream fails +ok {test-number} - Catch::makeStream( "%somestream" ) # resolution ok {test-number} - res.size() == count for: 10 == 10 # resolution @@ -4242,6 +4244,10 @@ ok {test-number} - Catch::Detail::stringify( set ) == "{ \"one\" }" for: "{ "one ok {test-number} - Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" for: "{ "abc", "def", "ghi" }" == "{ "abc", "def", "ghi" }" # std::vector > -> toString ok {test-number} - ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }" == "{ { "green", 55 } }" +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stderr" )->isStdout() for: true +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stdout" )->isStdout() for: true # stringify ranges ok {test-number} - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" # stringify ranges @@ -4458,5 +4464,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2228 +1..2231 diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt index e56cde86..e9f01e12 100644 --- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt @@ -4130,6 +4130,8 @@ ok {test-number} - letters == letters for: "abcdefcg" == "abcdefcg" ok {test-number} - Catch::replaceInPlace(s, "'", "|'") for: true # replaceInPlace ok {test-number} - s == "didn|'t" for: "didn|'t" == "didn|'t" +# request an unknown %-starting stream fails +ok {test-number} - Catch::makeStream( "%somestream" ) # resolution ok {test-number} - res.size() == count for: 10 == 10 # resolution @@ -4234,6 +4236,10 @@ ok {test-number} - Catch::Detail::stringify( set ) == "{ \"one\" }" for: "{ "one ok {test-number} - Catch::Detail::stringify( set ) == "{ \"abc\", \"def\", \"ghi\" }" for: "{ "abc", "def", "ghi" }" == "{ "abc", "def", "ghi" }" # std::vector > -> toString ok {test-number} - ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }" == "{ { "green", 55 } }" +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stderr" )->isStdout() for: true +# stdout and stderr streams have %-starting name +ok {test-number} - Catch::makeStream( "%stdout" )->isStdout() for: true # stringify ranges ok {test-number} - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)" # stringify ranges @@ -4450,5 +4456,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2228 +1..2231 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index ecd1ea02..4963db33 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -817,6 +817,8 @@ Message.tests.cpp:|nexpression failed with message:|n "this SHOULD ##teamcity[testFinished name='random SECTION tests' duration="{duration}"] ##teamcity[testStarted name='replaceInPlace'] ##teamcity[testFinished name='replaceInPlace' duration="{duration}"] +##teamcity[testStarted name='request an unknown %-starting stream fails'] +##teamcity[testFinished name='request an unknown %-starting stream fails' duration="{duration}"] ##teamcity[testStarted name='resolution'] ##teamcity[testFinished name='resolution' duration="{duration}"] ##teamcity[testStarted name='run_for_at_least, chronometer'] @@ -851,6 +853,8 @@ Message.tests.cpp:|nexpression failed with messages:|n "Count 4 to ##teamcity[testFinished name='std::set is convertible string' duration="{duration}"] ##teamcity[testStarted name='std::vector > -> toString'] ##teamcity[testFinished name='std::vector > -> toString' duration="{duration}"] +##teamcity[testStarted name='stdout and stderr streams have %-starting name'] +##teamcity[testFinished name='stdout and stderr streams have %-starting name' duration="{duration}"] ##teamcity[testStarted name='stringify ranges'] ##teamcity[testFinished name='stringify ranges' duration="{duration}"] ##teamcity[testStarted name='stringify( has_maker )'] diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt index 40b01067..b91e8c75 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt @@ -816,6 +816,8 @@ Message.tests.cpp:|nexpression failed with message:|n "this SHOULD ##teamcity[testFinished name='random SECTION tests' duration="{duration}"] ##teamcity[testStarted name='replaceInPlace'] ##teamcity[testFinished name='replaceInPlace' duration="{duration}"] +##teamcity[testStarted name='request an unknown %-starting stream fails'] +##teamcity[testFinished name='request an unknown %-starting stream fails' duration="{duration}"] ##teamcity[testStarted name='resolution'] ##teamcity[testFinished name='resolution' duration="{duration}"] ##teamcity[testStarted name='run_for_at_least, chronometer'] @@ -850,6 +852,8 @@ Message.tests.cpp:|nexpression failed with messages:|n "Count 4 to ##teamcity[testFinished name='std::set is convertible string' duration="{duration}"] ##teamcity[testStarted name='std::vector > -> toString'] ##teamcity[testFinished name='std::vector > -> toString' duration="{duration}"] +##teamcity[testStarted name='stdout and stderr streams have %-starting name'] +##teamcity[testFinished name='stdout and stderr streams have %-starting name' duration="{duration}"] ##teamcity[testStarted name='stringify ranges'] ##teamcity[testFinished name='stringify ranges' duration="{duration}"] ##teamcity[testStarted name='stringify( has_maker )'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 7ac33d42..203afd63 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -19353,6 +19353,17 @@ loose text artifact + + + + Catch::makeStream( "%somestream" ) + + + Catch::makeStream( "%somestream" ) + + + + @@ -19871,6 +19882,25 @@ loose text artifact + + + + Catch::makeStream( "%stderr" )->isStdout() + + + true + + + + + Catch::makeStream( "%stdout" )->isStdout() + + + true + + + + @@ -20901,6 +20931,6 @@ loose text artifact - - + + diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt index 9db2ef87..7ab2d2b0 100644 --- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt @@ -19352,6 +19352,17 @@ There is no extra whitespace here + + + + Catch::makeStream( "%somestream" ) + + + Catch::makeStream( "%somestream" ) + + + + @@ -19870,6 +19881,25 @@ There is no extra whitespace here + + + + Catch::makeStream( "%stderr" )->isStdout() + + + true + + + + + Catch::makeStream( "%stdout" )->isStdout() + + + true + + + + @@ -20900,6 +20930,6 @@ There is no extra whitespace here - - + + diff --git a/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp b/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp index 8a3aad46..4ba08ee5 100644 --- a/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp @@ -17,3 +17,12 @@ TEST_CASE( "Cout stream properly declares it writes to stdout", "[streams]" ) { TEST_CASE( "Empty stream name opens cout stream", "[streams]" ) { REQUIRE( Catch::makeStream( "" )->isStdout() ); } + +TEST_CASE( "stdout and stderr streams have %-starting name", "[streams]" ) { + REQUIRE( Catch::makeStream( "%stderr" )->isStdout() ); + REQUIRE( Catch::makeStream( "%stdout" )->isStdout() ); +} + +TEST_CASE( "request an unknown %-starting stream fails", "[streams]" ) { + REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ); +}