Read-only mirrors. Development, issues and pull requests are on GitHub.

summaryrefslogtreecommitdiffhomepage
path: root/src/catch2
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-01-09 19:01:14 +0100
committerMartin Hořeňovský2022-01-09 19:01:14 +0100
commitb6ff2c3dda9e071d8fa7acd2fa2518a7139e6386 (patch)
treeb92e4d9040120f9e52b0456d4bbd7db5ac7411db /src/catch2
parent875299cff05560f186eb34e26f7576da61cba65e (diff)
downloadcatch3-b6ff2c3dda9e071d8fa7acd2fa2518a7139e6386.tar.gz
Error out reporter registration for reporter names with '::'
Diffstat (limited to 'src/catch2')
-rw-r--r--src/catch2/internal/catch_reporter_registry.cpp3
1 files changed, 3 insertions, 0 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 ) {