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

summaryrefslogtreecommitdiffhomepage
path: root/tests/SelfTest
diff options
context:
space:
mode:
authorMartin Hořeňovský2022-02-17 20:44:27 +0100
committerMartin Hořeňovský2022-02-17 23:02:30 +0100
commitfc5552d27b57628f8faf6064ca6b305e2d3bf458 (patch)
treee1ffae9f5e92ad3eb31ad544c06b0e1e639c4d98 /tests/SelfTest
parent7cf2f88e50f0d1de324489c31db0314188423b6d (diff)
downloadcatch3-fc5552d27b57628f8faf6064ca6b305e2d3bf458.tar.gz
Push down handling of default reporter to Config's constructor
This simplifies the handling of default reporter in console parsing, at the cost of making `Config`'s constructor responsible for more things.
Diffstat (limited to 'tests/SelfTest')
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt8
-rw-r--r--tests/SelfTest/Baselines/compact.sw.multi.approved.txt8
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt20
-rw-r--r--tests/SelfTest/Baselines/console.sw.multi.approved.txt20
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/junit.sw.multi.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt8
-rw-r--r--tests/SelfTest/Baselines/tap.sw.multi.approved.txt8
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt28
-rw-r--r--tests/SelfTest/Baselines/xml.sw.multi.approved.txt28
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp16
12 files changed, 114 insertions, 36 deletions
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 20098061..87e318dd 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -1267,10 +1267,12 @@ CmdLine.tests.cpp:<line number>: passed: config.processName == "test" for: "test
CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == false for: false == false
CmdLine.tests.cpp:<line number>: passed: config.abortAfter == -1 for: -1 == -1
CmdLine.tests.cpp:<line number>: passed: config.noThrow == false for: false == false
-CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } for: { { console, <default-output> } }
-==
-{ { console, <default-output> } }
+CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications.empty() for: true
CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false
+CmdLine.tests.cpp:<line number>: passed: cfg.getReportersAndOutputFiles().size() == 1 for: 1 == 1
+CmdLine.tests.cpp:<line number>: passed: cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } for: { console, <default-output> }
+==
+{ console, <default-output> }
CmdLine.tests.cpp:<line number>: passed: result for: {?}
CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false for: false == false
diff --git a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
index 993a7b7c..6c7c1baf 100644
--- a/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.multi.approved.txt
@@ -1265,10 +1265,12 @@ CmdLine.tests.cpp:<line number>: passed: config.processName == "test" for: "test
CmdLine.tests.cpp:<line number>: passed: config.shouldDebugBreak == false for: false == false
CmdLine.tests.cpp:<line number>: passed: config.abortAfter == -1 for: -1 == -1
CmdLine.tests.cpp:<line number>: passed: config.noThrow == false for: false == false
-CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } for: { { console, <default-output> } }
-==
-{ { console, <default-output> } }
+CmdLine.tests.cpp:<line number>: passed: config.reporterSpecifications.empty() for: true
CmdLine.tests.cpp:<line number>: passed: !(cfg.hasTestFilters()) for: !false
+CmdLine.tests.cpp:<line number>: passed: cfg.getReportersAndOutputFiles().size() == 1 for: 1 == 1
+CmdLine.tests.cpp:<line number>: passed: cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } for: { console, <default-output> }
+==
+{ console, <default-output> }
CmdLine.tests.cpp:<line number>: passed: result for: {?}
CmdLine.tests.cpp:<line number>: passed: cfg.hasTestFilters() for: true
CmdLine.tests.cpp:<line number>: passed: cfg.testSpec().matches(*fakeTestCase("notIncluded")) == false for: false == false
diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt
index f6f6b292..195e0ccb 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1396,5 +1396,5 @@ due to unexpected exception with message:
===============================================================================
test cases: 381 | 305 passed | 69 failed | 7 failed as expected
-assertions: 2209 | 2054 passed | 128 failed | 27 failed as expected
+assertions: 2211 | 2056 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 8d1a25b4..d2d8a04f 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -9260,17 +9260,27 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
- CHECK( config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } )
+ CHECK( config.reporterSpecifications.empty() )
with expansion:
- { { console, <default-output> } }
- ==
- { { console, <default-output> } }
+ true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK_FALSE( cfg.hasTestFilters() )
with expansion:
!false
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( cfg.getReportersAndOutputFiles().size() == 1 )
+with expansion:
+ 1 == 1
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } )
+with expansion:
+ { console, <default-output> }
+ ==
+ { console, <default-output> }
+
-------------------------------------------------------------------------------
Process can be configured on command line
test lists
@@ -17755,5 +17765,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 381 | 291 passed | 83 failed | 7 failed as expected
-assertions: 2224 | 2054 passed | 143 failed | 27 failed as expected
+assertions: 2226 | 2056 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 920a1c7a..045f7e0d 100644
--- a/tests/SelfTest/Baselines/console.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.multi.approved.txt
@@ -9258,17 +9258,27 @@ with expansion:
false == false
CmdLine.tests.cpp:<line number>: PASSED:
- CHECK( config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } )
+ CHECK( config.reporterSpecifications.empty() )
with expansion:
- { { console, <default-output> } }
- ==
- { { console, <default-output> } }
+ true
CmdLine.tests.cpp:<line number>: PASSED:
CHECK_FALSE( cfg.hasTestFilters() )
with expansion:
!false
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( cfg.getReportersAndOutputFiles().size() == 1 )
+with expansion:
+ 1 == 1
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } )
+with expansion:
+ { console, <default-output> }
+ ==
+ { console, <default-output> }
+
-------------------------------------------------------------------------------
Process can be configured on command line
test lists
@@ -17747,5 +17757,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 381 | 291 passed | 83 failed | 7 failed as expected
-assertions: 2224 | 2054 passed | 143 failed | 27 failed as expected
+assertions: 2226 | 2056 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 c020fa4b..b259f75d 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="2224" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="126" tests="2226" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
diff --git a/tests/SelfTest/Baselines/junit.sw.multi.approved.txt b/tests/SelfTest/Baselines/junit.sw.multi.approved.txt
index 91398339..26b2f904 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="2224" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="126" tests="2226" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="random-seed" value="1"/>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt
index bd0e9881..5c36015e 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -2453,10 +2453,14 @@ ok {test-number} - config.abortAfter == -1 for: -1 == -1
# Process can be configured on command line
ok {test-number} - config.noThrow == false for: false == false
# Process can be configured on command line
-ok {test-number} - config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } for: { { console, <default-output> } } == { { console, <default-output> } }
+ok {test-number} - config.reporterSpecifications.empty() for: true
# Process can be configured on command line
ok {test-number} - !(cfg.hasTestFilters()) for: !false
# Process can be configured on command line
+ok {test-number} - cfg.getReportersAndOutputFiles().size() == 1 for: 1 == 1
+# Process can be configured on command line
+ok {test-number} - cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } for: { console, <default-output> } == { console, <default-output> }
+# Process can be configured on command line
ok {test-number} - result for: {?}
# Process can be configured on command line
ok {test-number} - cfg.hasTestFilters() for: true
@@ -4450,5 +4454,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
-1..2224
+1..2226
diff --git a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
index 59e8d1a8..9eb4aaca 100644
--- a/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.multi.approved.txt
@@ -2451,10 +2451,14 @@ ok {test-number} - config.abortAfter == -1 for: -1 == -1
# Process can be configured on command line
ok {test-number} - config.noThrow == false for: false == false
# Process can be configured on command line
-ok {test-number} - config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} } for: { { console, <default-output> } } == { { console, <default-output> } }
+ok {test-number} - config.reporterSpecifications.empty() for: true
# Process can be configured on command line
ok {test-number} - !(cfg.hasTestFilters()) for: !false
# Process can be configured on command line
+ok {test-number} - cfg.getReportersAndOutputFiles().size() == 1 for: 1 == 1
+# Process can be configured on command line
+ok {test-number} - cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } for: { console, <default-output> } == { console, <default-output> }
+# Process can be configured on command line
ok {test-number} - result for: {?}
# Process can be configured on command line
ok {test-number} - cfg.hasTestFilters() for: true
@@ -4442,5 +4446,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
-1..2224
+1..2226
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index 49b11484..91dc7e3c 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -11289,12 +11289,10 @@ Nor would this
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
- config.reporterSpecifications == std::vector&lt;Catch::ConfigData::ReporterAndFile>{ {"console", {}} }
+ config.reporterSpecifications.empty()
</Original>
<Expanded>
- { { console, &lt;default-output> } }
-==
-{ { console, &lt;default-output> } }
+ true
</Expanded>
</Expression>
<Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
@@ -11305,7 +11303,25 @@ Nor would this
!false
</Expanded>
</Expression>
- <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.getReportersAndOutputFiles().size() == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} }
+ </Original>
+ <Expanded>
+ { console, &lt;default-output> }
+==
+{ console, &lt;default-output> }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="9" failures="0" expectedFailures="0"/>
</Section>
<Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Section name="Specify one test case using" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
@@ -20863,6 +20879,6 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="2054" failures="143" expectedFailures="27"/>
+ <OverallResults successes="2056" failures="143" expectedFailures="27"/>
<OverallResultsCases successes="291" 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 f73fe121..e7dddbb0 100644
--- a/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.multi.approved.txt
@@ -11289,12 +11289,10 @@ Nor would this
</Expression>
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
- config.reporterSpecifications == std::vector&lt;Catch::ConfigData::ReporterAndFile>{ {"console", {}} }
+ config.reporterSpecifications.empty()
</Original>
<Expanded>
- { { console, &lt;default-output> } }
-==
-{ { console, &lt;default-output> } }
+ true
</Expanded>
</Expression>
<Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
@@ -11305,7 +11303,25 @@ Nor would this
!false
</Expanded>
</Expression>
- <OverallResults successes="7" failures="0" expectedFailures="0"/>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.getReportersAndOutputFiles().size() == 1
+ </Original>
+ <Expanded>
+ 1 == 1
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ cfg.getReportersAndOutputFiles()[0] == Catch::ConfigData::ReporterAndFile{ expectedReporter, {} }
+ </Original>
+ <Expanded>
+ { console, &lt;default-output> }
+==
+{ console, &lt;default-output> }
+ </Expanded>
+ </Expression>
+ <OverallResults successes="9" failures="0" expectedFailures="0"/>
</Section>
<Section name="test lists" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Section name="Specify one test case using" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
@@ -20862,6 +20878,6 @@ There is no extra whitespace here
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="2054" failures="143" expectedFailures="27"/>
+ <OverallResults successes="2056" failures="143" expectedFailures="27"/>
<OverallResultsCases successes="291" failures="83" expectedFailures="7"/>
</Catch2TestRun>
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index b4ec826b..97bccf49 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -11,6 +11,7 @@
#include <catch2/catch_test_macros.hpp>
#include <catch2/matchers/catch_matchers_string.hpp>
#include <catch2/internal/catch_test_spec_parser.hpp>
+#include <catch2/catch_user_config.hpp>
#include <catch2/catch_test_case_info.hpp>
#include <catch2/internal/catch_commandline.hpp>
#include <catch2/generators/catch_generators.hpp>
@@ -348,10 +349,23 @@ TEST_CASE( "Process can be configured on command line", "[config][command-line]"
CHECK(config.shouldDebugBreak == false);
CHECK(config.abortAfter == -1);
CHECK(config.noThrow == false);
- CHECK(config.reporterSpecifications == std::vector<Catch::ConfigData::ReporterAndFile>{ {"console", {}} });
+ CHECK( config.reporterSpecifications.empty() );
Catch::Config cfg(config);
CHECK_FALSE(cfg.hasTestFilters());
+
+ // The Config is responsible for mixing in the default reporter
+ auto expectedReporter =
+#if defined( CATCH_CONFIG_DEFAULT_REPORTER )
+ CATCH_CONFIG_DEFAULT_REPORTER
+#else
+ "console"
+#endif
+ ;
+
+ CHECK( cfg.getReportersAndOutputFiles().size() == 1 );
+ CHECK( cfg.getReportersAndOutputFiles()[0] ==
+ Catch::ConfigData::ReporterAndFile{ expectedReporter, {} } );
}
SECTION("test lists") {