Add check for registering multiple reporters under same name

This commit is contained in:
Martin Hořeňovský
2022-05-15 09:54:27 +02:00
parent fc3d11b1d1
commit 33aeb603fe
2 changed files with 17 additions and 1 deletions

View File

@@ -312,3 +312,18 @@ TEST_CASE("Registering reporter with '::' in name fails",
Catch::Detail::make_unique<TestReporterFactory>() ),
"'::' is not allowed in reporter name: 'with::doublecolons'" );
}
TEST_CASE("Registering multiple reporters with the same name fails",
"[reporters][registration][approvals]") {
Catch::ReporterRegistry registry;
registry.registerReporter(
"some-reporter-name",
Catch::Detail::make_unique<TestReporterFactory>() );
REQUIRE_THROWS_WITH(
registry.registerReporter(
"some-reporter-name",
Catch::Detail::make_unique<TestReporterFactory>() ),
"reporter using 'some-reporter-name' as name was already registered" );
}