Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Add IStream::isStdOut

Commit
715cd25081f008a4540cbcded266f400c9c57a2d
Author
Martin Hořeňovský ·
Parents
1d4b42ad7bd8

Files · Download .tar.gz

Changes

 src/catch2/internal/catch_stream.cpp               |  1 +
 src/catch2/internal/catch_stream.hpp               |  3 +++
 tests/CMakeLists.txt                               |  1 +
 tests/SelfTest/Baselines/automake.sw.approved.txt  |  2 ++
 .../Baselines/automake.sw.multi.approved.txt       |  2 ++
 tests/SelfTest/Baselines/compact.sw.approved.txt   |  2 ++
 .../Baselines/compact.sw.multi.approved.txt        |  2 ++
 tests/SelfTest/Baselines/console.std.approved.txt  |  4 ++--
 tests/SelfTest/Baselines/console.sw.approved.txt   | 26 ++++++++++++++++++++--
 .../Baselines/console.sw.multi.approved.txt        | 26 ++++++++++++++++++++--
 tests/SelfTest/Baselines/junit.sw.approved.txt     |  4 +++-
 .../SelfTest/Baselines/junit.sw.multi.approved.txt |  4 +++-
 tests/SelfTest/Baselines/sonarqube.sw.approved.txt |  4 ++++
 .../Baselines/sonarqube.sw.multi.approved.txt      |  4 ++++
 tests/SelfTest/Baselines/tap.sw.approved.txt       |  6 ++++-
 tests/SelfTest/Baselines/tap.sw.multi.approved.txt |  6 ++++-
 tests/SelfTest/Baselines/teamcity.sw.approved.txt  |  4 ++++
 .../Baselines/teamcity.sw.multi.approved.txt       |  4 ++++
 tests/SelfTest/Baselines/xml.sw.approved.txt       | 26 ++++++++++++++++++++--
 tests/SelfTest/Baselines/xml.sw.multi.approved.txt | 26 ++++++++++++++++++++--
 tests/SelfTest/IntrospectiveTests/Stream.tests.cpp | 19 ++++++++++++++++
 21 files changed, 162 insertions(+), 14 deletions(-)

diff --git a/src/catch2/internal/catch_stream.cpp b/src/catch2/internal/catch_stream.cpp
index eca83dda..5ce6e255 100644
--- a/src/catch2/internal/catch_stream.cpp
+++ b/src/catch2/internal/catch_stream.cpp
@@ -99,6 +99,7 @@ namespace Detail {
 
         public: // IStream
             std::ostream& stream() const override { return m_os; }
+            bool isStdout() const override { return true; }
         };
 
         ///////////////////////////////////////////////////////////////////////////
diff --git a/src/catch2/internal/catch_stream.hpp b/src/catch2/internal/catch_stream.hpp
index 39a4c0c8..77a35760 100644
--- a/src/catch2/internal/catch_stream.hpp
+++ b/src/catch2/internal/catch_stream.hpp
@@ -25,6 +25,9 @@ namespace Catch {
     struct IStream {
         virtual ~IStream(); // = default
         virtual std::ostream& stream() const = 0;
+        // Win32 colour supports requires us to identify whether a stream
+        // is backed by stdout (so we can colour it) or not (and we can't).
+        virtual bool isStdout() const { return false;  }
     };
 
     auto makeStream( std::string const& filename ) -> Detail::unique_ptr<IStream const>;
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 2115a690..d5521a84 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -90,6 +90,7 @@ set(TEST_SOURCES
         ${SELF_TEST_DIR}/IntrospectiveTests/TestSpecParser.tests.cpp
         ${SELF_TEST_DIR}/IntrospectiveTests/TextFlow.tests.cpp
         ${SELF_TEST_DIR}/IntrospectiveTests/Sharding.tests.cpp
+        ${SELF_TEST_DIR}/IntrospectiveTests/Stream.tests.cpp
         ${SELF_TEST_DIR}/IntrospectiveTests/String.tests.cpp
         ${SELF_TEST_DIR}/IntrospectiveTests/StringManip.tests.cpp
         ${SELF_TEST_DIR}/IntrospectiveTests/Xml.tests.cpp
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt
index c575637f..bfeb3da7 100644
--- a/tests/SelfTest/Baselines/automake.sw.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.approved.txt
@@ -122,11 +122,13 @@ Nor would this
 :test-result: PASS Composed matchers shortcircuit
 :test-result: FAIL Contains string matcher
 :test-result: PASS Copy and then generate a range
+:test-result: PASS Cout stream properly declares it writes to stdout
 :test-result: FAIL Custom exceptions can be translated when testing for nothrow
 :test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
 :test-result: FAIL Custom std-exceptions can be custom translated
 :test-result: PASS Default scale is invisible to comparison
 :test-result: PASS Directly creating an EnumInfo
+:test-result: PASS Empty stream name opens cout stream
 :test-result: PASS Empty tag is not allowed
 :test-result: FAIL EndsWith string matcher
 :test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM
diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt
index 31c0b106..a4070375 100644
--- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt
@@ -120,11 +120,13 @@
 :test-result: PASS Composed matchers shortcircuit
 :test-result: FAIL Contains string matcher
 :test-result: PASS Copy and then generate a range
+:test-result: PASS Cout stream properly declares it writes to stdout
 :test-result: FAIL Custom exceptions can be translated when testing for nothrow
 :test-result: FAIL Custom exceptions can be translated when testing for throwing as something else
 :test-result: FAIL Custom std-exceptions can be custom translated
 :test-result: PASS Default scale is invisible to comparison
 :test-result: PASS Directly creating an EnumInfo
+:test-result: PASS Empty stream name opens cout stream
 :test-result: PASS Empty tag is not allowed
 :test-result: FAIL EndsWith string matcher
 :test-result: PASS Enums can quickly have stringification enabled using REGISTER_ENUM
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 87e318dd..ea0ba61a 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -479,6 +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
 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'
@@ -489,6 +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
 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)
diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
index 6c7c1baf..4de9e7eb 100644
--- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
@@ -477,6 +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
 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'
@@ -487,6 +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
 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)
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index 195e0ccb..0b6a78bc 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:  381 |  305 passed |  69 failed |  7 failed as expected
-assertions: 2211 | 2056 passed | 128 failed | 27 failed as expected
+test cases:  383 |  307 passed |  69 failed |  7 failed as expected
+assertions: 2213 | 2058 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 d2d8a04f..8eb882e3 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -3805,6 +3805,17 @@ Generators.tests.cpp:<line number>: PASSED:
 with expansion:
   6 == 6
 
+-------------------------------------------------------------------------------
+Cout stream properly declares it writes to stdout
+-------------------------------------------------------------------------------
+Stream.tests.cpp:<line number>
+...............................................................................
+
+Stream.tests.cpp:<line number>: PASSED:
+  REQUIRE( Catch::makeStream( "-" )->isStdout() )
+with expansion:
+  true
+
 -------------------------------------------------------------------------------
 Custom exceptions can be translated when testing for nothrow
 -------------------------------------------------------------------------------
@@ -3876,6 +3887,17 @@ with expansion:
   ==
   "{** unexpected enum value **}"
 
+-------------------------------------------------------------------------------
+Empty stream name opens cout stream
+-------------------------------------------------------------------------------
+Stream.tests.cpp:<line number>
+...............................................................................
+
+Stream.tests.cpp:<line number>: PASSED:
+  REQUIRE( Catch::makeStream( "" )->isStdout() )
+with expansion:
+  true
+
 -------------------------------------------------------------------------------
 Empty tag is not allowed
 -------------------------------------------------------------------------------
@@ -17764,6 +17786,6 @@ Misc.tests.cpp:<line number>
 Misc.tests.cpp:<line number>: PASSED:
 
 ===============================================================================
-test cases:  381 |  291 passed |  83 failed |  7 failed as expected
-assertions: 2226 | 2056 passed | 143 failed | 27 failed as expected
+test cases:  383 |  293 passed |  83 failed |  7 failed as expected
+assertions: 2228 | 2058 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 045f7e0d..64ff619b 100644
--- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt
@@ -3803,6 +3803,17 @@ Generators.tests.cpp:<line number>: PASSED:
 with expansion:
   6 == 6
 
+-------------------------------------------------------------------------------
+Cout stream properly declares it writes to stdout
+-------------------------------------------------------------------------------
+Stream.tests.cpp:<line number>
+...............................................................................
+
+Stream.tests.cpp:<line number>: PASSED:
+  REQUIRE( Catch::makeStream( "-" )->isStdout() )
+with expansion:
+  true
+
 -------------------------------------------------------------------------------
 Custom exceptions can be translated when testing for nothrow
 -------------------------------------------------------------------------------
@@ -3874,6 +3885,17 @@ with expansion:
   ==
   "{** unexpected enum value **}"
 
+-------------------------------------------------------------------------------
+Empty stream name opens cout stream
+-------------------------------------------------------------------------------
+Stream.tests.cpp:<line number>
+...............................................................................
+
+Stream.tests.cpp:<line number>: PASSED:
+  REQUIRE( Catch::makeStream( "" )->isStdout() )
+with expansion:
+  true
+
 -------------------------------------------------------------------------------
 Empty tag is not allowed
 -------------------------------------------------------------------------------
@@ -17756,6 +17778,6 @@ Misc.tests.cpp:<line number>
 Misc.tests.cpp:<line number>: PASSED:
 
 ===============================================================================
-test cases:  381 |  291 passed |  83 failed |  7 failed as expected
-assertions: 2226 | 2056 passed | 143 failed | 27 failed as expected
+test cases:  383 |  293 passed |  83 failed |  7 failed as expected
+assertions: 2228 | 2058 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 b259f75d..e9db7259 100644
--- a/tests/SelfTest/Baselines/junit.sw.approved.txt
+++ b/tests/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuitesloose text artifact
 >
-  <testsuite name="<exe-name>" errors="17" failures="126" tests="2226" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="17" failures="126" tests="2228" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <properties>
       <property name="random-seed" value="1"/>
       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
@@ -425,6 +425,7 @@ Matchers.tests.cpp:<line number>
     <testcase classname="<exe-name>.global" name="Copy and then generate a range/from var and iterators" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Copy and then generate a range/From a temporary container" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Copy and then generate a range/Final validation" time="{duration}" status="run"/>
+    <testcase classname="<exe-name>.global" name="Cout stream properly declares it writes to stdout" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for nothrow" time="{duration}" status="run">
       <error message="throwCustom()" type="REQUIRE_NOTHROW">
 FAILED:
@@ -450,6 +451,7 @@ Exception.tests.cpp:<line number>
     </testcase>
     <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/>
+    <testcase classname="<exe-name>.global" name="Empty stream name opens cout stream" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Empty tag is not allowed" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}" status="run">
       <failure message="testStringForMatching(), EndsWith( &quot;Substring&quot; )" type="CHECK_THAT">
diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
index 26b2f904..820be769 100644
--- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuites>
-  <testsuite name="<exe-name>" errors="17" failures="126" tests="2226" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="17" failures="126" tests="2228" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <properties>
       <property name="random-seed" value="1"/>
       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
@@ -424,6 +424,7 @@ Matchers.tests.cpp:<line number>
     <testcase classname="<exe-name>.global" name="Copy and then generate a range/from var and iterators" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Copy and then generate a range/From a temporary container" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Copy and then generate a range/Final validation" time="{duration}" status="run"/>
+    <testcase classname="<exe-name>.global" name="Cout stream properly declares it writes to stdout" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Custom exceptions can be translated when testing for nothrow" time="{duration}" status="run">
       <error message="throwCustom()" type="REQUIRE_NOTHROW">
 FAILED:
@@ -449,6 +450,7 @@ Exception.tests.cpp:<line number>
     </testcase>
     <testcase classname="<exe-name>.global" name="Default scale is invisible to comparison" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Directly creating an EnumInfo" time="{duration}" status="run"/>
+    <testcase classname="<exe-name>.global" name="Empty stream name opens cout stream" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Empty tag is not allowed" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="EndsWith string matcher" time="{duration}" status="run">
       <failure message="testStringForMatching(), EndsWith( &quot;Substring&quot; )" type="CHECK_THAT">
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
index cc901e29..0b5dfb42 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
@@ -216,6 +216,10 @@
     <testCase name="The default listing implementation write to provided stream/Listing reporters" duration="{duration}"/>
     <testCase name="The default listing implementation write to provided stream/Listing tests" duration="{duration}"/>
   </file>
+  <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}"/>
+  </file>
   <file path="tests/<exe-name>/IntrospectiveTests/String.tests.cpp">
     <testCase name="StringRef/Empty string" duration="{duration}"/>
     <testCase name="StringRef/From string literal" duration="{duration}"/>
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt
index 0359fa40..27061535 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt
@@ -215,6 +215,10 @@
     <testCase name="The default listing implementation write to provided stream/Listing reporters" duration="{duration}"/>
     <testCase name="The default listing implementation write to provided stream/Listing tests" duration="{duration}"/>
   </file>
+  <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}"/>
+  </file>
   <file path="tests/<exe-name>/IntrospectiveTests/String.tests.cpp">
     <testCase name="StringRef/Empty string" duration="{duration}"/>
     <testCase name="StringRef/From string literal" duration="{duration}"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index 5c36015e..f9f01296 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -956,6 +956,8 @@ ok {test-number} - elem % 2 == 1 for: 1 == 1
 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
 # 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
@@ -972,6 +974,8 @@ ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
 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
 # Empty tag is not allowed
 ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo )
 # EndsWith string matcher
@@ -4454,5 +4458,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
 ok {test-number} -
 # xmlentitycheck
 ok {test-number} -
-1..2226
+1..2228
 
diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
index 9eb4aaca..e56cde86 100644
--- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
@@ -954,6 +954,8 @@ ok {test-number} - elem % 2 == 1 for: 1 == 1
 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
 # 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
@@ -970,6 +972,8 @@ ok {test-number} - enumInfo->lookup(0) == "Value1" for: Value1 == "Value1"
 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
 # Empty tag is not allowed
 ok {test-number} - Catch::TestCaseInfo( "", { "fake test name", "[]" }, dummySourceLineInfo )
 # EndsWith string matcher
@@ -4446,5 +4450,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
 ok {test-number} -
 # xmlentitycheck
 ok {test-number} -
-1..2226
+1..2228
 
diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
index e7279bc4..ecd1ea02 100644
--- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt
+++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
@@ -279,6 +279,8 @@ Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringFor
 ##teamcity[testFinished name='Contains string matcher' duration="{duration}"]
 ##teamcity[testStarted name='Copy and then generate a range']
 ##teamcity[testFinished name='Copy and then generate a range' duration="{duration}"]
+##teamcity[testStarted name='Cout stream properly declares it writes to stdout']
+##teamcity[testFinished name='Cout stream properly declares it writes to stdout' duration="{duration}"]
 ##teamcity[testStarted name='Custom exceptions can be translated when testing for nothrow']
 Exception.tests.cpp:<line number>|nunexpected exception with message:|n  "custom exception - not std"|n  REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n  throwCustom()|n']
 ##teamcity[testFinished name='Custom exceptions can be translated when testing for nothrow' duration="{duration}"]
@@ -292,6 +294,8 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n  "custom
 ##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"]
 ##teamcity[testStarted name='Directly creating an EnumInfo']
 ##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"]
+##teamcity[testStarted name='Empty stream name opens cout stream']
+##teamcity[testFinished name='Empty stream name opens cout stream' duration="{duration}"]
 ##teamcity[testStarted name='Empty tag is not allowed']
 ##teamcity[testFinished name='Empty tag is not allowed' duration="{duration}"]
 ##teamcity[testStarted name='EndsWith string matcher']
diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt
index 28912d91..40b01067 100644
--- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt
@@ -279,6 +279,8 @@ Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringFor
 ##teamcity[testFinished name='Contains string matcher' duration="{duration}"]
 ##teamcity[testStarted name='Copy and then generate a range']
 ##teamcity[testFinished name='Copy and then generate a range' duration="{duration}"]
+##teamcity[testStarted name='Cout stream properly declares it writes to stdout']
+##teamcity[testFinished name='Cout stream properly declares it writes to stdout' duration="{duration}"]
 ##teamcity[testStarted name='Custom exceptions can be translated when testing for nothrow']
 Exception.tests.cpp:<line number>|nunexpected exception with message:|n  "custom exception - not std"|n  REQUIRE_NOTHROW( throwCustom() )|nwith expansion:|n  throwCustom()|n']
 ##teamcity[testFinished name='Custom exceptions can be translated when testing for nothrow' duration="{duration}"]
@@ -292,6 +294,8 @@ Exception.tests.cpp:<line number>|nunexpected exception with message:|n  "custom
 ##teamcity[testFinished name='Default scale is invisible to comparison' duration="{duration}"]
 ##teamcity[testStarted name='Directly creating an EnumInfo']
 ##teamcity[testFinished name='Directly creating an EnumInfo' duration="{duration}"]
+##teamcity[testStarted name='Empty stream name opens cout stream']
+##teamcity[testFinished name='Empty stream name opens cout stream' duration="{duration}"]
 ##teamcity[testStarted name='Empty tag is not allowed']
 ##teamcity[testFinished name='Empty tag is not allowed' duration="{duration}"]
 ##teamcity[testStarted name='EndsWith string matcher']
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index 91dc7e3c..7ac33d42 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -4205,6 +4205,17 @@ Nor would this
     </Section>
     <OverallResult success="true"/>
   </TestCase>
+  <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()
+      </Original>
+      <Expanded>
+        true
+      </Expanded>
+    </Expression>
+    <OverallResult success="true"/>
+  </TestCase>
   <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
     <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
       <Original>
@@ -4287,6 +4298,17 @@ Nor would this
     </Expression>
     <OverallResult success="true"/>
   </TestCase>
+  <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()
+      </Original>
+      <Expanded>
+        true
+      </Expanded>
+    </Expression>
+    <OverallResult success="true"/>
+  </TestCase>
   <TestCase name="Empty tag is not allowed" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
     <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
       <Original>
@@ -20879,6 +20901,6 @@ loose text artifact
     </Section>
     <OverallResult success="true"/>
   </TestCase>
-  <OverallResults successes="2056" failures="143" expectedFailures="27"/>
-  <OverallResultsCases successes="291" failures="83" expectedFailures="7"/>
+  <OverallResults successes="2058" failures="143" expectedFailures="27"/>
+  <OverallResultsCases successes="293" failures="83" expectedFailures="7"/>
 </Catch2TestRun>
diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
index e7dddbb0..9db2ef87 100644
--- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
@@ -4205,6 +4205,17 @@ Nor would this
     </Section>
     <OverallResult success="true"/>
   </TestCase>
+  <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()
+      </Original>
+      <Expanded>
+        true
+      </Expanded>
+    </Expression>
+    <OverallResult success="true"/>
+  </TestCase>
   <TestCase name="Custom exceptions can be translated when testing for nothrow" tags="[!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
     <Expression success="false" type="REQUIRE_NOTHROW" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
       <Original>
@@ -4287,6 +4298,17 @@ Nor would this
     </Expression>
     <OverallResult success="true"/>
   </TestCase>
+  <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()
+      </Original>
+      <Expanded>
+        true
+      </Expanded>
+    </Expression>
+    <OverallResult success="true"/>
+  </TestCase>
   <TestCase name="Empty tag is not allowed" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
     <Expression success="true" type="REQUIRE_THROWS" filename="tests/<exe-name>/IntrospectiveTests/Tag.tests.cpp" >
       <Original>
@@ -20878,6 +20900,6 @@ There is no extra whitespace here
     </Section>
     <OverallResult success="true"/>
   </TestCase>
-  <OverallResults successes="2056" failures="143" expectedFailures="27"/>
-  <OverallResultsCases successes="291" failures="83" expectedFailures="7"/>
+  <OverallResults successes="2058" failures="143" expectedFailures="27"/>
+  <OverallResultsCases successes="293" failures="83" expectedFailures="7"/>
 </Catch2TestRun>
diff --git a/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp b/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp
new file mode 100644
index 00000000..8a3aad46
--- /dev/null
+++ b/tests/SelfTest/IntrospectiveTests/Stream.tests.cpp
@@ -0,0 +1,19 @@
+
+//              Copyright Catch2 Authors
+// Distributed under the Boost Software License, Version 1.0.
+//   (See accompanying file LICENSE_1_0.txt or copy at
+//        https://www.boost.org/LICENSE_1_0.txt)
+
+// SPDX-License-Identifier: BSL-1.0
+
+#include <catch2/catch_test_macros.hpp>
+
+#include <catch2/internal/catch_stream.hpp>
+
+TEST_CASE( "Cout stream properly declares it writes to stdout", "[streams]" ) {
+    REQUIRE( Catch::makeStream( "-" )->isStdout() );
+}
+
+TEST_CASE( "Empty stream name opens cout stream", "[streams]" ) {
+    REQUIRE( Catch::makeStream( "" )->isStdout() );
+}