X35-DuplicatedReporterNames.cpp 997 B

12345678910111213141516171819202122232425262728293031
  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. * Checks that reporter registration errors are caught and handled as
  8. * startup errors, by causing a registration error by registering multiple
  9. * reporters with the same name.
  10. */
  11. #include <catch2/catch_test_macros.hpp>
  12. #include <catch2/reporters/catch_reporter_registrars.hpp>
  13. #include <catch2/reporters/catch_reporter_streaming_base.hpp>
  14. namespace {
  15. //! Trivial custom reporter for registration
  16. class TestReporter : public Catch::StreamingReporterBase {
  17. public:
  18. using StreamingReporterBase::StreamingReporterBase;
  19. static std::string getDescription() { return "X35 test reporter"; }
  20. };
  21. }
  22. CATCH_REGISTER_REPORTER( "test-reporter", TestReporter )
  23. CATCH_REGISTER_REPORTER( "test-reporter", TestReporter )