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 /tests/SelfTest | |
| parent | 875299cff05560f186eb34e26f7576da61cba65e (diff) | |
| download | catch3-b6ff2c3dda9e071d8fa7acd2fa2518a7139e6386.tar.gz | |
Error out reporter registration for reporter names with '::'
Diffstat (limited to 'tests/SelfTest')
18 files changed, 100 insertions, 14 deletions
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 @@ -10177,6 +10177,18 @@ with expansion: '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 ------------------------------------------------------------------------------- Matchers.tests.cpp:<line number> @@ -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 @@ -10175,6 +10175,18 @@ with expansion: '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 ------------------------------------------------------------------------------- Matchers.tests.cpp:<line number> @@ -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<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<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'" ); +} |