diff options
| author | Martin Hořeňovský | 2022-05-15 09:54:27 +0200 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-05-15 09:54:27 +0200 |
| commit | 33aeb603fee982d8f7d5aec3e746741e8776942e (patch) | |
| tree | d277147429c02fe98a74fc9f41491e75c86d2986 /tests | |
| parent | fc3d11b1d1090a5bcbcc9e410a460f9bf6a1f474 (diff) | |
| download | catch3-33aeb603fee982d8f7d5aec3e746741e8776942e.tar.gz | |
Add check for registering multiple reporters under same name
Diffstat (limited to 'tests')
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp index 5dde7038..97d1ad25 100644 --- a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp @@ -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" ); +} |