| 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 | /**\file |
| 10 | * Test that reporter registration is case-preserving, selection is |
| 11 | * case-insensitive. |
| 12 | * |
| 13 | * This is done by registering a custom reporter that prints out a marker |
| 14 | * string upon construction and then invoking the binary with different |
| 15 | * casings of the name. |
| 16 | */ |
| 17 | |
| 18 | #include <catch2/reporters/catch_reporter_streaming_base.hpp> |
| 19 | #include <catch2/reporters/catch_reporter_registrars.hpp> |
| 20 | |
| 21 | #include <iostream> |
| 22 | #include <utility> |
| 23 | |
| 24 | class TestReporter : public Catch::StreamingReporterBase { |
| 25 | public: |
| 26 | TestReporter(Catch::ReporterConfig&& _config): |
| 27 | StreamingReporterBase(std::move(_config)) { |
| 28 | std::cout << "TestReporter constructed\n"; |
| 29 | } |
| 30 | |
| 31 | static std::string getDescription() { |
| 32 | return "Reporter for testing casing handling in reporter registration/selection"; |
| 33 | } |
| 34 | |
| 35 | ~TestReporter() override; |
| 36 | }; |
| 37 | |
| 38 | TestReporter::~TestReporter() = default; |
| 39 | |
| 40 | CATCH_REGISTER_REPORTER("testReporterCASED", TestReporter) |
| 41 |