Add %stderr and %stdout as recognized magic stream names

This commit is contained in:
Martin Hořeňovský 2022-03-07 10:42:26 +01:00
parent 61d0f7a9af
commit 06f74a0f8e
No known key found for this signature in database
GPG Key ID: DE48307B8B0D381A
19 changed files with 194 additions and 19 deletions

View File

@ -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,13 +142,17 @@ namespace Detail {
if ( filename.empty() || filename == "-" ) {
return Detail::make_unique<Detail::CoutStream>();
}
else if( filename[0] == '%' ) {
if( filename == "%debug" )
if( filename[0] == '%' ) {
if ( filename == "%debug" ) {
return Detail::make_unique<Detail::DebugOutStream>();
else
} else if ( filename == "%stderr" ) {
return Detail::make_unique<Detail::CerrStream>();
} else if ( filename == "%stdout" ) {
return Detail::make_unique<Detail::CoutStream>();
} else {
CATCH_ERROR( "Unrecognised stream: '" << filename << '\'' );
}
else
}
return Detail::make_unique<Detail::FileStream>( filename );
}

View File

@ -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<int,std::string> -> toString
:test-result: PASS std::set is convertible string
:test-result: PASS std::vector<std::pair<std::string,int> > -> 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 )

View File

@ -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<int,std::string> -> toString
:test-result: PASS std::set is convertible string
:test-result: PASS std::vector<std::pair<std::string,int> > -> 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 )

View File

@ -2309,6 +2309,7 @@ StringManip.tests.cpp:<line number>: passed: !(Catch::replaceInPlace(letters, "x
StringManip.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'") for: true
StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%somestream" )
InternalBenchmark.tests.cpp:<line number>: passed: res.size() == count for: 10 == 10
InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>)
InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>)
@ -2367,6 +2368,8 @@ ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( set )
ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }"
==
"{ { "green", 55 } }"
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stderr" )->isStdout() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stdout" )->isStdout() for: true
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)"
==
"op<<(streamable_range)"

View File

@ -2301,6 +2301,7 @@ StringManip.tests.cpp:<line number>: passed: !(Catch::replaceInPlace(letters, "x
StringManip.tests.cpp:<line number>: passed: letters == letters for: "abcdefcg" == "abcdefcg"
StringManip.tests.cpp:<line number>: passed: Catch::replaceInPlace(s, "'", "|'") for: true
StringManip.tests.cpp:<line number>: passed: s == "didn|'t" for: "didn|'t" == "didn|'t"
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%somestream" )
InternalBenchmark.tests.cpp:<line number>: passed: res.size() == count for: 10 == 10
InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>)
InternalBenchmark.tests.cpp:<line number>: passed: res[i] == rate for: 1000.0 == 1000 (0x<hex digits>)
@ -2359,6 +2360,8 @@ ToStringGeneral.tests.cpp:<line number>: passed: Catch::Detail::stringify( set )
ToStringPair.tests.cpp:<line number>: passed: ::Catch::Detail::stringify( pr ) == "{ { \"green\", 55 } }" for: "{ { "green", 55 } }"
==
"{ { "green", 55 } }"
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stderr" )->isStdout() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stdout" )->isStdout() for: true
ToStringWhich.tests.cpp:<line number>: passed: ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)"
==
"op<<(streamable_range)"

View File

@ -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

View File

@ -16447,6 +16447,15 @@ StringManip.tests.cpp:<line number>: PASSED:
with expansion:
"didn|'t" == "didn|'t"
-------------------------------------------------------------------------------
request an unknown %-starting stream fails
-------------------------------------------------------------------------------
Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: 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:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stderr" )->isStdout() )
with expansion:
true
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stdout" )->isStdout() )
with expansion:
true
-------------------------------------------------------------------------------
stringify ranges
-------------------------------------------------------------------------------
@ -17786,6 +17811,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: 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

View File

@ -16439,6 +16439,15 @@ StringManip.tests.cpp:<line number>: PASSED:
with expansion:
"didn|'t" == "didn|'t"
-------------------------------------------------------------------------------
request an unknown %-starting stream fails
-------------------------------------------------------------------------------
Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: 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:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stderr" )->isStdout() )
with expansion:
true
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stdout" )->isStdout() )
with expansion:
true
-------------------------------------------------------------------------------
stringify ranges
-------------------------------------------------------------------------------
@ -17778,6 +17803,6 @@ Misc.tests.cpp:<line number>
Misc.tests.cpp:<line number>: 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

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuitesloose text artifact
>
<testsuite name="<exe-name>" errors="17" failures="126" tests="2228" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="126" tests="2231" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
@ -1785,6 +1785,7 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="replaceInPlace/replace all chars" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="replaceInPlace/replace no chars" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="replaceInPlace/escape '" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="request an unknown %-starting stream fails" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="resolution" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="run_for_at_least, chronometer" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="run_for_at_least, int" time="{duration}" status="run"/>
@ -1837,6 +1838,7 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="std::set is convertible string/single item" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::set is convertible string/several items" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::vector&lt;std::pair&lt;std::string,int> > -> toString" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stdout and stderr streams have %-starting name" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stringify ranges" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stringify( has_maker )" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stringify( has_maker_and_operator )" time="{duration}" status="run"/>

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<testsuites>
<testsuite name="<exe-name>" errors="17" failures="126" tests="2228" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<testsuite name="<exe-name>" errors="17" failures="126" tests="2231" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
@ -1784,6 +1784,7 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="replaceInPlace/replace all chars" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="replaceInPlace/replace no chars" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="replaceInPlace/escape '" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="request an unknown %-starting stream fails" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="resolution" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="run_for_at_least, chronometer" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="run_for_at_least, int" time="{duration}" status="run"/>
@ -1836,6 +1837,7 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="std::set is convertible string/single item" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::set is convertible string/several items" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="std::vector&lt;std::pair&lt;std::string,int> > -> toString" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stdout and stderr streams have %-starting name" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stringify ranges" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stringify( has_maker )" time="{duration}" status="run"/>
<testcase classname="<exe-name>.global" name="stringify( has_maker_and_operator )" time="{duration}" status="run"/>

View File

@ -219,6 +219,8 @@
<file path="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp">
<testCase name="Cout stream properly declares it writes to stdout" duration="{duration}"/>
<testCase name="Empty stream name opens cout stream" duration="{duration}"/>
<testCase name="request an unknown %-starting stream fails" duration="{duration}"/>
<testCase name="stdout and stderr streams have %-starting name" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/String.tests.cpp">
<testCase name="StringRef/Empty string" duration="{duration}"/>

View File

@ -218,6 +218,8 @@
<file path="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp">
<testCase name="Cout stream properly declares it writes to stdout" duration="{duration}"/>
<testCase name="Empty stream name opens cout stream" duration="{duration}"/>
<testCase name="request an unknown %-starting stream fails" duration="{duration}"/>
<testCase name="stdout and stderr streams have %-starting name" duration="{duration}"/>
</file>
<file path="tests/<exe-name>/IntrospectiveTests/String.tests.cpp">
<testCase name="StringRef/Empty string" duration="{duration}"/>

View File

@ -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<std::pair<std::string,int> > -> 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

View File

@ -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<std::pair<std::string,int> > -> 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

View File

@ -817,6 +817,8 @@ Message.tests.cpp:<line number>|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:<line number>|nexpression failed with messages:|n "Count 4 to
##teamcity[testFinished name='std::set is convertible string' duration="{duration}"]
##teamcity[testStarted name='std::vector<std::pair<std::string,int> > -> toString']
##teamcity[testFinished name='std::vector<std::pair<std::string,int> > -> 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 )']

View File

@ -816,6 +816,8 @@ Message.tests.cpp:<line number>|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:<line number>|nexpression failed with messages:|n "Count 4 to
##teamcity[testFinished name='std::set is convertible string' duration="{duration}"]
##teamcity[testStarted name='std::vector<std::pair<std::string,int> > -> toString']
##teamcity[testFinished name='std::vector<std::pair<std::string,int> > -> 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 )']

View File

@ -19353,6 +19353,17 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="request an unknown %-starting stream fails" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%somestream" )
</Original>
<Expanded>
Catch::makeStream( "%somestream" )
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" >
<Original>
@ -19871,6 +19882,25 @@ loose text artifact
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="stdout and stderr streams have %-starting name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%stderr" )->isStdout()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%stdout" )->isStdout()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="stringify ranges" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Original>
@ -20901,6 +20931,6 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="2058" failures="143" expectedFailures="27"/>
<OverallResultsCases successes="293" failures="83" expectedFailures="7"/>
<OverallResults successes="2061" failures="143" expectedFailures="27"/>
<OverallResultsCases successes="295" failures="83" expectedFailures="7"/>
</Catch2TestRun>

View File

@ -19352,6 +19352,17 @@ There is no extra whitespace here
</Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="request an unknown %-starting stream fails" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%somestream" )
</Original>
<Expanded>
Catch::makeStream( "%somestream" )
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="resolution" tags="[benchmark]" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/InternalBenchmark.tests.cpp" >
<Original>
@ -19870,6 +19881,25 @@ There is no extra whitespace here
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="stdout and stderr streams have %-starting name" tags="[streams]" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%stderr" )->isStdout()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%stdout" )->isStdout()
</Original>
<Expanded>
true
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="stringify ranges" tags="[toString]" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/ToStringWhich.tests.cpp" >
<Original>
@ -20900,6 +20930,6 @@ There is no extra whitespace here
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="2058" failures="143" expectedFailures="27"/>
<OverallResultsCases successes="293" failures="83" expectedFailures="7"/>
<OverallResults successes="2061" failures="143" expectedFailures="27"/>
<OverallResultsCases successes="295" failures="83" expectedFailures="7"/>
</Catch2TestRun>

View File

@ -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" ) );
}