Progmasoft Git

catch3

Progmasoft Catch3: an independently maintained C++17 test framework with a parallel runner, property checks, snapshots and structured results.

Clonegit clone https://git.progmasoft.com/catch3

Error out reporter registration for reporter names with '::'

Commit
b6ff2c3dda9e071d8fa7acd2fa2518a7139e6386
Author
Martin Hořeňovský ·
Parents
875299cff055

Files · Download .tar.gz

Changes

 src/catch2/internal/catch_reporter_registry.cpp    |  3 +++
 tests/SelfTest/Baselines/automake.sw.approved.txt  |  1 +
 .../Baselines/automake.sw.multi.approved.txt       |  1 +
 tests/SelfTest/Baselines/compact.sw.approved.txt   |  1 +
 .../Baselines/compact.sw.multi.approved.txt        |  1 +
 tests/SelfTest/Baselines/console.std.approved.txt  |  4 ++--
 tests/SelfTest/Baselines/console.sw.approved.txt   | 16 +++++++++++++--
 .../Baselines/console.sw.multi.approved.txt        | 16 +++++++++++++--
 tests/SelfTest/Baselines/junit.sw.approved.txt     |  3 ++-
 .../SelfTest/Baselines/junit.sw.multi.approved.txt |  3 ++-
 tests/SelfTest/Baselines/sonarqube.sw.approved.txt |  1 +
 .../Baselines/sonarqube.sw.multi.approved.txt      |  1 +
 tests/SelfTest/Baselines/tap.sw.approved.txt       |  4 +++-
 tests/SelfTest/Baselines/tap.sw.multi.approved.txt |  4 +++-
 tests/SelfTest/Baselines/teamcity.sw.approved.txt  |  2 ++
 .../Baselines/teamcity.sw.multi.approved.txt       |  2 ++
 tests/SelfTest/Baselines/xml.sw.approved.txt       | 15 ++++++++++++--
 tests/SelfTest/Baselines/xml.sw.multi.approved.txt | 15 ++++++++++++--
 .../IntrospectiveTests/Reporters.tests.cpp         | 24 ++++++++++++++++++++++
 19 files changed, 103 insertions(+), 14 deletions(-)

diff --git a/src/catch2/internal/catch_reporter_registry.cpp b/src/catch2/internal/catch_reporter_registry.cpp
index 26a328f8..67687d1b 100644
--- a/src/catch2/internal/catch_reporter_registry.cpp
+++ b/src/catch2/internal/catch_reporter_registry.cpp
@@ -17,6 +17,7 @@
 #include <catch2/reporters/catch_reporter_teamcity.hpp>
 #include <catch2/reporters/catch_reporter_xml.hpp>
 #include <catch2/internal/catch_move_and_forward.hpp>
+#include <catch2/internal/catch_enforce.hpp>
 
 namespace Catch {
 
@@ -44,6 +45,8 @@ namespace Catch {
     }
 
     void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr factory ) {
+        CATCH_ENFORCE( name.find( "::" ) == name.npos,
+                       "'::' is not allowed in reporter name: '" + name + '\'' );
         m_factories.emplace(name, CATCH_MOVE(factory));
     }
     void ReporterRegistry::registerListener( IReporterFactoryPtr factory ) {
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt
index 34a28749..1fff117c 100644
--- a/tests/SelfTest/Baselines/automake.sw.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.approved.txt
@@ -199,6 +199,7 @@ Nor would this
 :test-result: PASS Range type with sentinel
 :test-result: FAIL Reconstruction should be based on stringification: #914
 :test-result: FAIL Regex string matcher
+:test-result: PASS Registering reporter with '::' in name fails
 :test-result: PASS Regression test #1
 :test-result: PASS Reporter's write listings to provided stream
 :test-result: PASS Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla
diff --git a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt
index e45cec60..4b75ed64 100644
--- a/tests/SelfTest/Baselines/automake.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/automake.sw.multi.approved.txt
@@ -197,6 +197,7 @@
 :test-result: PASS Range type with sentinel
 :test-result: FAIL Reconstruction should be based on stringification: #914
 :test-result: FAIL Regex string matcher
+:test-result: PASS Registering reporter with '::' in name fails
 :test-result: PASS Regression test #1
 :test-result: PASS Reporter's write listings to provided stream
 :test-result: PASS Reproducer for #2309 - a very long description past 80 chars (default console width) with a late colon : blablabla
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 0babaf7d..f921fc2d 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -1383,6 +1383,7 @@ Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truth
 Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively
 Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches( "contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
 Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches( "this string contains 'abc' as a" ) for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively
+Reporters.tests.cpp:<line number>: passed: registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'"
 Matchers.tests.cpp:<line number>: passed: actual, !UnorderedEquals( expected ) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' }
 Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
 Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "All available tags:
diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
index 1966443b..ffd0932a 100644
--- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
@@ -1381,6 +1381,7 @@ Decomposition.tests.cpp:<line number>: failed: truthy(false) for: Hey, its truth
 Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches( "this STRING contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "this STRING contains 'abc' as a substring" case sensitively
 Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches( "contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
 Matchers.tests.cpp:<line number>: failed: testStringForMatching(), Matches( "this string contains 'abc' as a" ) for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively
+Reporters.tests.cpp:<line number>: passed: registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'"
 Matchers.tests.cpp:<line number>: passed: actual, !UnorderedEquals( expected ) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' }
 Reporters.tests.cpp:<line number>: passed: !(factories.empty()) for: !false
 Reporters.tests.cpp:<line number>: passed: listingString, ContainsSubstring("fakeTag"s) for: "All available tags:
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index ac979989..ca299535 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1395,6 +1395,6 @@ due to unexpected exception with message:
   Why would you throw a std::string?
 
 ===============================================================================
-test cases:  382 |  306 passed |  69 failed |  7 failed as expected
-assertions: 2211 | 2056 passed | 128 failed | 27 failed as expected
+test cases:  383 |  307 passed |  69 failed |  7 failed as expected
+assertions: 2212 | 2057 passed | 128 failed | 27 failed as expected
 
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index 5d733c77..11ee162e 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -10176,6 +10176,18 @@ with expansion:
   "this string contains 'abc' as a substring" matches "this string contains
   'abc' as a" case sensitively
 
+-------------------------------------------------------------------------------
+Registering reporter with '::' in name fails
+-------------------------------------------------------------------------------
+Reporters.tests.cpp:<line number>
+...............................................................................
+
+Reporters.tests.cpp:<line number>: PASSED:
+  REQUIRE_THROWS_WITH( registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" )
+with expansion:
+  "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is
+  not allowed in reporter name: 'with::doublecolons'"
+
 -------------------------------------------------------------------------------
 Regression test #1
 -------------------------------------------------------------------------------
@@ -17772,6 +17784,6 @@ Misc.tests.cpp:<line number>
 Misc.tests.cpp:<line number>: PASSED:
 
 ===============================================================================
-test cases:  382 |  292 passed |  83 failed |  7 failed as expected
-assertions: 2226 | 2056 passed | 143 failed | 27 failed as expected
+test cases:  383 |  293 passed |  83 failed |  7 failed as expected
+assertions: 2227 | 2057 passed | 143 failed | 27 failed as expected
 
diff --git a/tests/SelfTest/Baselines/console.sw.multi.approved.txt b/tests/SelfTest/Baselines/console.sw.multi.approved.txt
index ad44370c..9155ad62 100644
--- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt
@@ -10174,6 +10174,18 @@ with expansion:
   "this string contains 'abc' as a substring" matches "this string contains
   'abc' as a" case sensitively
 
+-------------------------------------------------------------------------------
+Registering reporter with '::' in name fails
+-------------------------------------------------------------------------------
+Reporters.tests.cpp:<line number>
+...............................................................................
+
+Reporters.tests.cpp:<line number>: PASSED:
+  REQUIRE_THROWS_WITH( registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" )
+with expansion:
+  "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is
+  not allowed in reporter name: 'with::doublecolons'"
+
 -------------------------------------------------------------------------------
 Regression test #1
 -------------------------------------------------------------------------------
@@ -17764,6 +17776,6 @@ Misc.tests.cpp:<line number>
 Misc.tests.cpp:<line number>: PASSED:
 
 ===============================================================================
-test cases:  382 |  292 passed |  83 failed |  7 failed as expected
-assertions: 2226 | 2056 passed | 143 failed | 27 failed as expected
+test cases:  383 |  293 passed |  83 failed |  7 failed as expected
+assertions: 2227 | 2057 passed | 143 failed | 27 failed as expected
 
diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt
index e3398a6a..459b77ed 100644
--- a/tests/SelfTest/Baselines/junit.sw.approved.txt
+++ b/tests/SelfTest/Baselines/junit.sw.approved.txt
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuitesloose text artifact
 >
-  <testsuite name="<exe-name>" errors="17" failures="126" tests="2226" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="17" failures="126" tests="2227" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <properties>
       <property name="random-seed" value="1"/>
       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
@@ -1166,6 +1166,7 @@ with expansion:
 Matchers.tests.cpp:<line number>
       </failure>
     </testcase>
+    <testcase classname="<exe-name>.global" name="Registering reporter with '::' in name fails" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Regression test #1" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/Automake reporter lists tags" time="{duration}" status="run"/>
diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
index b1ae7efd..8f8eccf2 100644
--- a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <testsuites>
-  <testsuite name="<exe-name>" errors="17" failures="126" tests="2226" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+  <testsuite name="<exe-name>" errors="17" failures="126" tests="2227" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
     <properties>
       <property name="random-seed" value="1"/>
       <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
@@ -1165,6 +1165,7 @@ with expansion:
 Matchers.tests.cpp:<line number>
       </failure>
     </testcase>
+    <testcase classname="<exe-name>.global" name="Registering reporter with '::' in name fails" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Regression test #1" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream" time="{duration}" status="run"/>
     <testcase classname="<exe-name>.global" name="Reporter's write listings to provided stream/Automake reporter lists tags" time="{duration}" status="run"/>
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
index 081ae969..e597f41a 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
@@ -185,6 +185,7 @@
     <testCase name="Multireporter updates ReporterPreferences properly" duration="{duration}"/>
     <testCase name="Multireporter updates ReporterPreferences properly/Adding listeners" duration="{duration}"/>
     <testCase name="Multireporter updates ReporterPreferences properly/Adding reporters" duration="{duration}"/>
+    <testCase name="Registering reporter with '::' in name fails" duration="{duration}"/>
     <testCase name="Reporter's write listings to provided stream" duration="{duration}"/>
     <testCase name="Reporter's write listings to provided stream/Automake reporter lists tags" duration="{duration}"/>
     <testCase name="Reporter's write listings to provided stream/Automake reporter lists reporters" duration="{duration}"/>
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt
index cf9c15ce..9637e8a1 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.multi.approved.txt
@@ -184,6 +184,7 @@
     <testCase name="Multireporter updates ReporterPreferences properly" duration="{duration}"/>
     <testCase name="Multireporter updates ReporterPreferences properly/Adding listeners" duration="{duration}"/>
     <testCase name="Multireporter updates ReporterPreferences properly/Adding reporters" duration="{duration}"/>
+    <testCase name="Registering reporter with '::' in name fails" duration="{duration}"/>
     <testCase name="Reporter's write listings to provided stream" duration="{duration}"/>
     <testCase name="Reporter's write listings to provided stream/Automake reporter lists tags" duration="{duration}"/>
     <testCase name="Reporter's write listings to provided stream/Automake reporter lists reporters" duration="{duration}"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index e49f387e..6306f579 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -2652,6 +2652,8 @@ not ok {test-number} - testStringForMatching(), Matches( "this STRING contains '
 not ok {test-number} - testStringForMatching(), Matches( "contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
 # Regex string matcher
 not ok {test-number} - testStringForMatching(), Matches( "this string contains 'abc' as a" ) for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively
+# Registering reporter with '::' in name fails
+ok {test-number} - registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'"
 # Regression test #1
 ok {test-number} - actual, !UnorderedEquals( expected ) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' }
 # Reporter's write listings to provided stream
@@ -4454,5 +4456,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
 ok {test-number} -
 # xmlentitycheck
 ok {test-number} -
-1..2226
+1..2227
 
diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
index f8599833..c6b4a8bd 100644
--- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
@@ -2650,6 +2650,8 @@ not ok {test-number} - testStringForMatching(), Matches( "this STRING contains '
 not ok {test-number} - testStringForMatching(), Matches( "contains 'abc' as a substring" ) for: "this string contains 'abc' as a substring" matches "contains 'abc' as a substring" case sensitively
 # Regex string matcher
 not ok {test-number} - testStringForMatching(), Matches( "this string contains 'abc' as a" ) for: "this string contains 'abc' as a substring" matches "this string contains 'abc' as a" case sensitively
+# Registering reporter with '::' in name fails
+ok {test-number} - registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique<TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'" for: "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'"
 # Regression test #1
 ok {test-number} - actual, !UnorderedEquals( expected ) for: { 'a', 'b' } not UnorderedEquals: { 'c', 'b' }
 # Reporter's write listings to provided stream
@@ -4446,5 +4448,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
 ok {test-number} -
 # xmlentitycheck
 ok {test-number} -
-1..2226
+1..2227
 
diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
index d73f02ae..90e318f1 100644
--- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt
+++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt
@@ -507,6 +507,8 @@ Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringFor
 Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n  "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n']
 Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n  "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n']
 ##teamcity[testFinished name='Regex string matcher' duration="{duration}"]
+##teamcity[testStarted name='Registering reporter with |'::|' in name fails']
+##teamcity[testFinished name='Registering reporter with |'::|' in name fails' duration="{duration}"]
 ##teamcity[testStarted name='Regression test #1']
 ##teamcity[testFinished name='Regression test #1' duration="{duration}"]
 ##teamcity[testStarted name='Reporter|'s write listings to provided stream']
diff --git a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt
index 3560775f..dc266f2f 100644
--- a/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/teamcity.sw.multi.approved.txt
@@ -507,6 +507,8 @@ Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringFor
 Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringForMatching(), Matches( "contains |'abc|' as a substring" ) )|nwith expansion:|n  "this string contains |'abc|' as a substring" matches "contains |'abc|' as a substring" case sensitively|n']
 Matchers.tests.cpp:<line number>|nexpression failed|n  CHECK_THAT( testStringForMatching(), Matches( "this string contains |'abc|' as a" ) )|nwith expansion:|n  "this string contains |'abc|' as a substring" matches "this string contains |'abc|' as a" case sensitively|n']
 ##teamcity[testFinished name='Regex string matcher' duration="{duration}"]
+##teamcity[testStarted name='Registering reporter with |'::|' in name fails']
+##teamcity[testFinished name='Registering reporter with |'::|' in name fails' duration="{duration}"]
 ##teamcity[testStarted name='Regression test #1']
 ##teamcity[testFinished name='Regression test #1' duration="{duration}"]
 ##teamcity[testStarted name='Reporter|'s write listings to provided stream']
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index b7d5bb15..1305af19 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -12416,6 +12416,17 @@ Nor would this
     </Expression>
     <OverallResult success="false"/>
   </TestCase>
+  <TestCase name="Registering reporter with '::' in name fails" tags="[registration][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
+    <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
+      <Original>
+        registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique&lt;TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'"
+      </Original>
+      <Expanded>
+        "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'"
+      </Expanded>
+    </Expression>
+    <OverallResult success="true"/>
+  </TestCase>
   <TestCase name="Regression test #1" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
     <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
       <Original>
@@ -20884,6 +20895,6 @@ loose text artifact
     </Section>
     <OverallResult success="true"/>
   </TestCase>
-  <OverallResults successes="2056" failures="143" expectedFailures="27"/>
-  <OverallResultsCases successes="292" failures="83" expectedFailures="7"/>
+  <OverallResults successes="2057" failures="143" expectedFailures="27"/>
+  <OverallResultsCases successes="293" failures="83" expectedFailures="7"/>
 </Catch2TestRun>
diff --git a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
index 9a70d37e..f03c7986 100644
--- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
@@ -12416,6 +12416,17 @@ Nor would this
     </Expression>
     <OverallResult success="false"/>
   </TestCase>
+  <TestCase name="Registering reporter with '::' in name fails" tags="[registration][reporters]" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
+    <Expression success="true" type="REQUIRE_THROWS_WITH" filename="tests/<exe-name>/IntrospectiveTests/Reporters.tests.cpp" >
+      <Original>
+        registry.registerReporter( "with::doublecolons", Catch::Detail::make_unique&lt;TestReporterFactory>() ), "'::' is not allowed in reporter name: 'with::doublecolons'"
+      </Original>
+      <Expanded>
+        "'::' is not allowed in reporter name: 'with::doublecolons'" equals: "'::' is not allowed in reporter name: 'with::doublecolons'"
+      </Expanded>
+    </Expression>
+    <OverallResult success="true"/>
+  </TestCase>
   <TestCase name="Regression test #1" tags="[matchers][vector]" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
     <Expression success="true" type="CHECK_THAT" filename="tests/<exe-name>/UsageTests/Matchers.tests.cpp" >
       <Original>
@@ -20883,6 +20894,6 @@ There is no extra whitespace here
     </Section>
     <OverallResult success="true"/>
   </TestCase>
-  <OverallResults successes="2056" failures="143" expectedFailures="27"/>
-  <OverallResultsCases successes="292" failures="83" expectedFailures="7"/>
+  <OverallResults successes="2057" failures="143" expectedFailures="27"/>
+  <OverallResultsCases successes="293" failures="83" expectedFailures="7"/>
 </Catch2TestRun>
diff --git a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
index 8bb04352..40ae0179 100644
--- a/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/Reporters.tests.cpp
@@ -13,7 +13,9 @@
 #include <catch2/interfaces/catch_interfaces_reporter.hpp>
 #include <catch2/interfaces/catch_interfaces_reporter_factory.hpp>
 #include <catch2/interfaces/catch_interfaces_reporter_registry.hpp>
+#include <catch2/internal/catch_enforce.hpp>
 #include <catch2/internal/catch_list.hpp>
+#include <catch2/internal/catch_reporter_registry.hpp>
 #include <catch2/matchers/catch_matchers_string.hpp>
 #include <catch2/reporters/catch_reporter_helpers.hpp>
 #include <catch2/reporters/catch_reporter_event_listener.hpp>
@@ -260,3 +262,25 @@ TEST_CASE("Multireporter updates ReporterPreferences properly",
         REQUIRE( multiReporter.getPreferences().shouldReportAllAssertions == true );
     }
 }
+
+namespace {
+    class TestReporterFactory : public Catch::IReporterFactory {
+        Catch::IStreamingReporterPtr create( Catch::ReporterConfig const& ) const override {
+            CATCH_INTERNAL_ERROR(
+                "This factory should never create a reporter" );
+        }
+        std::string getDescription() const override {
+            return "Fake test factory";
+        }
+    };
+}
+
+TEST_CASE("Registering reporter with '::' in name fails",
+          "[reporters][registration]") {
+    Catch::ReporterRegistry registry;
+
+    REQUIRE_THROWS_WITH( registry.registerReporter(
+        "with::doublecolons",
+        Catch::Detail::make_unique<TestReporterFactory>() ),
+        "'::' is not allowed in reporter name: 'with::doublecolons'" );
+}