X23-CasingInReporterNames.cpp 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright Catch2 Authors
  2. // Distributed under the Boost Software License, Version 1.0.
  3. // (See accompanying file LICENSE_1_0.txt or copy at
  4. // https://www.boost.org/LICENSE_1_0.txt)
  5. // SPDX-License-Identifier: BSL-1.0
  6. /**\file
  7. * Test that reporter registration is case-preserving, selection is
  8. * case-insensitive.
  9. *
  10. * This is done by registering a custom reporter that prints out a marker
  11. * string upon construction and then invoking the binary with different
  12. * casings of the name.
  13. */
  14. #include <catch2/reporters/catch_reporter_streaming_base.hpp>
  15. #include <catch2/reporters/catch_reporter_registrars.hpp>
  16. #include <iostream>
  17. #include <utility>
  18. class TestReporter : public Catch::StreamingReporterBase {
  19. public:
  20. TestReporter(Catch::ReporterConfig&& _config):
  21. StreamingReporterBase(std::move(_config)) {
  22. std::cout << "TestReporter constructed\n";
  23. }
  24. static std::string getDescription() {
  25. return "Reporter for testing casing handling in reporter registration/selection";
  26. }
  27. ~TestReporter() override;
  28. };
  29. TestReporter::~TestReporter() = default;
  30. CATCH_REGISTER_REPORTER("testReporterCASED", TestReporter)