Rename isStdout => isConsole and add doccomment

This commit is contained in:
Martin Hořeňovský
2022-03-21 00:22:54 +01:00
parent cf6dd937ab
commit 4d8acafecb
12 changed files with 52 additions and 43 deletions

View File

@@ -479,7 +479,7 @@ Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
Generators.tests.cpp:<line number>: passed: call_count == 1 for: 1 == 1
Generators.tests.cpp:<line number>: passed: make_data().size() == test_count for: 6 == 6
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "-" )->isStdout() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "-" )->isConsole() for: true
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception - not std'; expression was: throwCustom()
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception - not std'; expression was: throwCustom(), std::exception
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
@@ -490,7 +490,7 @@ ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: V
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
==
"{** unexpected enum value **}"
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isStdout() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isConsole() for: true
Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo )
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring"
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
@@ -2368,8 +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
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stderr" )->isConsole() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stdout" )->isConsole() 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

@@ -477,7 +477,7 @@ Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
Generators.tests.cpp:<line number>: passed: elem % 2 == 1 for: 1 == 1
Generators.tests.cpp:<line number>: passed: call_count == 1 for: 1 == 1
Generators.tests.cpp:<line number>: passed: make_data().size() == test_count for: 6 == 6
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "-" )->isStdout() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "-" )->isConsole() for: true
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception - not std'; expression was: throwCustom()
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom exception - not std'; expression was: throwCustom(), std::exception
Exception.tests.cpp:<line number>: failed: unexpected exception with message: 'custom std exception'
@@ -488,7 +488,7 @@ ToString.tests.cpp:<line number>: passed: enumInfo->lookup(1) == "Value2" for: V
ToString.tests.cpp:<line number>: passed: enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **}
==
"{** unexpected enum value **}"
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isStdout() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "" )->isConsole() for: true
Tag.tests.cpp:<line number>: passed: Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo )
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "Substring" ) for: "this string contains 'abc' as a substring" ends with: "Substring"
Matchers.tests.cpp:<line number>: failed: testStringForMatching(), EndsWith( "this", Catch::CaseSensitive::No ) for: "this string contains 'abc' as a substring" ends with: "this" (case insensitive)
@@ -2360,8 +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
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stderr" )->isConsole() for: true
Stream.tests.cpp:<line number>: passed: Catch::makeStream( "%stdout" )->isConsole() 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

@@ -3812,7 +3812,7 @@ Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "-" )->isStdout() )
REQUIRE( Catch::makeStream( "-" )->isConsole() )
with expansion:
true
@@ -3894,7 +3894,7 @@ Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "" )->isStdout() )
REQUIRE( Catch::makeStream( "" )->isConsole() )
with expansion:
true
@@ -16859,12 +16859,12 @@ Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stderr" )->isStdout() )
REQUIRE( Catch::makeStream( "%stderr" )->isConsole() )
with expansion:
true
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stdout" )->isStdout() )
REQUIRE( Catch::makeStream( "%stdout" )->isConsole() )
with expansion:
true

View File

@@ -3810,7 +3810,7 @@ Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "-" )->isStdout() )
REQUIRE( Catch::makeStream( "-" )->isConsole() )
with expansion:
true
@@ -3892,7 +3892,7 @@ Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "" )->isStdout() )
REQUIRE( Catch::makeStream( "" )->isConsole() )
with expansion:
true
@@ -16851,12 +16851,12 @@ Stream.tests.cpp:<line number>
...............................................................................
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stderr" )->isStdout() )
REQUIRE( Catch::makeStream( "%stderr" )->isConsole() )
with expansion:
true
Stream.tests.cpp:<line number>: PASSED:
REQUIRE( Catch::makeStream( "%stdout" )->isStdout() )
REQUIRE( Catch::makeStream( "%stdout" )->isConsole() )
with expansion:
true

View File

@@ -957,7 +957,7 @@ ok {test-number} - call_count == 1 for: 1 == 1
# Copy and then generate a range
ok {test-number} - make_data().size() == test_count for: 6 == 6
# Cout stream properly declares it writes to stdout
ok {test-number} - Catch::makeStream( "-" )->isStdout() for: true
ok {test-number} - Catch::makeStream( "-" )->isConsole() for: true
# Custom exceptions can be translated when testing for nothrow
not ok {test-number} - unexpected exception with message: 'custom exception - not std'; expression was: throwCustom()
# Custom exceptions can be translated when testing for throwing as something else
@@ -975,7 +975,7 @@ ok {test-number} - enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
# Directly creating an EnumInfo
ok {test-number} - enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}"
# Empty stream name opens cout stream
ok {test-number} - Catch::makeStream( "" )->isStdout() for: true
ok {test-number} - Catch::makeStream( "" )->isConsole() for: true
# Empty tag is not allowed
ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo )
# EndsWith string matcher
@@ -4245,9 +4245,9 @@ ok {test-number} - Catch::Detail::stringify( set ) == "{ \"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
ok {test-number} - Catch::makeStream( "%stderr" )->isConsole() for: true
# stdout and stderr streams have %-starting name
ok {test-number} - Catch::makeStream( "%stdout" )->isStdout() for: true
ok {test-number} - Catch::makeStream( "%stdout" )->isConsole() for: true
# stringify ranges
ok {test-number} - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)"
# stringify ranges

View File

@@ -955,7 +955,7 @@ ok {test-number} - call_count == 1 for: 1 == 1
# Copy and then generate a range
ok {test-number} - make_data().size() == test_count for: 6 == 6
# Cout stream properly declares it writes to stdout
ok {test-number} - Catch::makeStream( "-" )->isStdout() for: true
ok {test-number} - Catch::makeStream( "-" )->isConsole() for: true
# Custom exceptions can be translated when testing for nothrow
not ok {test-number} - unexpected exception with message: 'custom exception - not std'; expression was: throwCustom()
# Custom exceptions can be translated when testing for throwing as something else
@@ -973,7 +973,7 @@ ok {test-number} - enumInfo->lookup(1) == "Value2" for: Value2 == "Value2"
# Directly creating an EnumInfo
ok {test-number} - enumInfo->lookup(3) == "{** unexpected enum value **}" for: {** unexpected enum value **} == "{** unexpected enum value **}"
# Empty stream name opens cout stream
ok {test-number} - Catch::makeStream( "" )->isStdout() for: true
ok {test-number} - Catch::makeStream( "" )->isConsole() for: true
# Empty tag is not allowed
ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo )
# EndsWith string matcher
@@ -4237,9 +4237,9 @@ ok {test-number} - Catch::Detail::stringify( set ) == "{ \"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
ok {test-number} - Catch::makeStream( "%stderr" )->isConsole() for: true
# stdout and stderr streams have %-starting name
ok {test-number} - Catch::makeStream( "%stdout" )->isStdout() for: true
ok {test-number} - Catch::makeStream( "%stdout" )->isConsole() for: true
# stringify ranges
ok {test-number} - ::Catch::Detail::stringify(streamable_range{}) == "op<<(streamable_range)" for: "op<<(streamable_range)" == "op<<(streamable_range)"
# stringify ranges

View File

@@ -4208,7 +4208,7 @@ Nor would this
<TestCase name="Cout stream properly declares it writes to stdout" 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( "-" )->isStdout()
Catch::makeStream( "-" )->isConsole()
</Original>
<Expanded>
true
@@ -4301,7 +4301,7 @@ Nor would this
<TestCase name="Empty stream name opens cout stream" 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( "" )->isStdout()
Catch::makeStream( "" )->isConsole()
</Original>
<Expanded>
true
@@ -19885,7 +19885,7 @@ loose text artifact
<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()
Catch::makeStream( "%stderr" )->isConsole()
</Original>
<Expanded>
true
@@ -19893,7 +19893,7 @@ loose text artifact
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%stdout" )->isStdout()
Catch::makeStream( "%stdout" )->isConsole()
</Original>
<Expanded>
true

View File

@@ -4208,7 +4208,7 @@ Nor would this
<TestCase name="Cout stream properly declares it writes to stdout" 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( "-" )->isStdout()
Catch::makeStream( "-" )->isConsole()
</Original>
<Expanded>
true
@@ -4301,7 +4301,7 @@ Nor would this
<TestCase name="Empty stream name opens cout stream" 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( "" )->isStdout()
Catch::makeStream( "" )->isConsole()
</Original>
<Expanded>
true
@@ -19884,7 +19884,7 @@ There is no extra whitespace here
<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()
Catch::makeStream( "%stderr" )->isConsole()
</Original>
<Expanded>
true
@@ -19892,7 +19892,7 @@ There is no extra whitespace here
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/Stream.tests.cpp" >
<Original>
Catch::makeStream( "%stdout" )->isStdout()
Catch::makeStream( "%stdout" )->isConsole()
</Original>
<Expanded>
true

View File

@@ -11,16 +11,16 @@
#include <catch2/internal/catch_stream.hpp>
TEST_CASE( "Cout stream properly declares it writes to stdout", "[streams]" ) {
REQUIRE( Catch::makeStream( "-" )->isStdout() );
REQUIRE( Catch::makeStream( "-" )->isConsole() );
}
TEST_CASE( "Empty stream name opens cout stream", "[streams]" ) {
REQUIRE( Catch::makeStream( "" )->isStdout() );
REQUIRE( Catch::makeStream( "" )->isConsole() );
}
TEST_CASE( "stdout and stderr streams have %-starting name", "[streams]" ) {
REQUIRE( Catch::makeStream( "%stderr" )->isStdout() );
REQUIRE( Catch::makeStream( "%stdout" )->isStdout() );
REQUIRE( Catch::makeStream( "%stderr" )->isConsole() );
REQUIRE( Catch::makeStream( "%stdout" )->isConsole() );
}
TEST_CASE( "request an unknown %-starting stream fails", "[streams]" ) {