| 1 | |
| 2 | // Copyright Catch2 Authors |
| 3 | // Distributed under the Boost Software License, Version 1.0. |
| 4 | // (See accompanying file LICENSE.txt or copy at |
| 5 | // https://www.boost.org/LICENSE_1_0.txt) |
| 6 | |
| 7 | // SPDX-License-Identifier: BSL-1.0 |
| 8 | |
| 9 | #include <catch2/catch_test_macros.hpp> |
| 10 | |
| 11 | #include <catch2/internal/catch_istream.hpp> |
| 12 | |
| 13 | TEST_CASE( "Cout stream properly declares it writes to stdout", "[streams]" ) { |
| 14 | REQUIRE( Catch::makeStream( "-" )->isConsole() ); |
| 15 | } |
| 16 | |
| 17 | TEST_CASE( "Empty stream name opens cout stream", "[streams]" ) { |
| 18 | REQUIRE( Catch::makeStream( "" )->isConsole() ); |
| 19 | } |
| 20 | |
| 21 | TEST_CASE( "stdout and stderr streams have %-starting name", "[streams]" ) { |
| 22 | REQUIRE( Catch::makeStream( "%stderr" )->isConsole() ); |
| 23 | REQUIRE( Catch::makeStream( "%stdout" )->isConsole() ); |
| 24 | } |
| 25 | |
| 26 | TEST_CASE( "request an unknown %-starting stream fails", "[streams]" ) { |
| 27 | REQUIRE_THROWS( Catch::makeStream( "%somestream" ) ); |
| 28 | } |
| 29 | |
| 30 | TEST_CASE( "makeStream recognizes %debug stream name", "[streams]" ) { |
| 31 | REQUIRE_NOTHROW( Catch::makeStream( "%debug" ) ); |
| 32 | } |