diff options
| author | Martin Hořeňovský | 2022-01-09 19:01:14 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2022-01-09 19:01:14 +0100 |
| commit | b6ff2c3dda9e071d8fa7acd2fa2518a7139e6386 (patch) | |
| tree | b92e4d9040120f9e52b0456d4bbd7db5ac7411db /src | |
| parent | 875299cff05560f186eb34e26f7576da61cba65e (diff) | |
| download | catch3-b6ff2c3dda9e071d8fa7acd2fa2518a7139e6386.tar.gz | |
Error out reporter registration for reporter names with '::'
Diffstat (limited to 'src')
| -rw-r--r-- | src/catch2/internal/catch_reporter_registry.cpp | 3 |
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 ) { |