diff options
| author | Martin Hořeňovský | 2021-12-18 20:48:43 +0100 |
|---|---|---|
| committer | Martin Hořeňovský | 2021-12-18 20:50:05 +0100 |
| commit | 3cc0c033e4c359dfea006b749416a0cd3a322c1c (patch) | |
| tree | 34181026aef41ade6f4662893bc2268a928b7bd6 /tests/SelfTest | |
| parent | 840acedf62b2dabb98bf4ab372a7582131d6b530 (diff) | |
| download | catch3-3cc0c033e4c359dfea006b749416a0cd3a322c1c.tar.gz | |
Allow enabling multiple warnings in one invocation
Diffstat (limited to 'tests/SelfTest')
| -rw-r--r-- | tests/SelfTest/Baselines/automake.sw.approved.txt | 1 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/compact.sw.approved.txt | 5 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/console.std.approved.txt | 4 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/console.sw.approved.txt | 50 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/junit.sw.approved.txt | 5 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/sonarqube.sw.approved.txt | 3 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/tap.sw.approved.txt | 12 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/teamcity.sw.approved.txt | 2 | ||||
| -rw-r--r-- | tests/SelfTest/Baselines/xml.sw.approved.txt | 56 | ||||
| -rw-r--r-- | tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp | 22 |
10 files changed, 152 insertions, 8 deletions
diff --git a/tests/SelfTest/Baselines/automake.sw.approved.txt b/tests/SelfTest/Baselines/automake.sw.approved.txt index c77739c3..8fff84db 100644 --- a/tests/SelfTest/Baselines/automake.sw.approved.txt +++ b/tests/SelfTest/Baselines/automake.sw.approved.txt @@ -179,6 +179,7 @@ Nor would this :test-result: PASS Overloaded comma or address-of operators are not used :test-result: PASS Parse test names and tags :test-result: PASS Parsing sharding-related cli flags +:test-result: PASS Parsing warnings :test-result: PASS Pointers can be compared to null :test-result: PASS Precision of floating point stringification can be set :test-result: PASS Predicate matcher can accept const char* diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt index 3cd8ba4c..66b385a5 100644 --- a/tests/SelfTest/Baselines/compact.sw.approved.txt +++ b/tests/SelfTest/Baselines/compact.sw.approved.txt @@ -1200,6 +1200,11 @@ CmdLine.tests.cpp:<line number>: passed: !(result) for: !{?} CmdLine.tests.cpp:<line number>: passed: result.errorMessage(), ContainsSubstring("Shard index must be a non-negative number") for: "Shard index must be a non-negative number" contains: "Shard index must be a non-negative number" CmdLine.tests.cpp:<line number>: passed: cli.parse({ "test", "--shard-index=0" }) for: {?} CmdLine.tests.cpp:<line number>: passed: config.shardIndex == 0 for: 0 == 0 +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "-w", "NoAssertions" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.warnings == WarnAbout::NoAssertions for: 1 == 1 +CmdLine.tests.cpp:<line number>: passed: !(cli.parse( { "test", "-w", "NoTests" } )) for: !{?} +CmdLine.tests.cpp:<line number>: passed: cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) for: {?} +CmdLine.tests.cpp:<line number>: passed: config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) for: 3 == 3 Condition.tests.cpp:<line number>: passed: p == 0 for: 0 == 0 Condition.tests.cpp:<line number>: passed: p == pNULL for: 0 == 0 Condition.tests.cpp:<line number>: passed: p != 0 for: 0x<hex digits> != 0 diff --git a/tests/SelfTest/Baselines/console.std.approved.txt b/tests/SelfTest/Baselines/console.std.approved.txt index 17f9d281..4147f373 100644 --- a/tests/SelfTest/Baselines/console.std.approved.txt +++ b/tests/SelfTest/Baselines/console.std.approved.txt @@ -1426,6 +1426,6 @@ due to unexpected exception with message: Why would you throw a std::string? =============================================================================== -test cases: 376 | 299 passed | 70 failed | 7 failed as expected -assertions: 2149 | 1993 passed | 129 failed | 27 failed as expected +test cases: 377 | 300 passed | 70 failed | 7 failed as expected +assertions: 2154 | 1998 passed | 129 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt index 32654bc3..764ac970 100644 --- a/tests/SelfTest/Baselines/console.sw.approved.txt +++ b/tests/SelfTest/Baselines/console.sw.approved.txt @@ -8785,6 +8785,52 @@ with expansion: 0 == 0 ------------------------------------------------------------------------------- +Parsing warnings + NoAssertions +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cli.parse( { "test", "-w", "NoAssertions" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.warnings == WarnAbout::NoAssertions ) +with expansion: + 1 == 1 + +------------------------------------------------------------------------------- +Parsing warnings + NoTests is no longer supported +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE_FALSE( cli.parse( { "test", "-w", "NoTests" } ) ) +with expansion: + !{?} + +------------------------------------------------------------------------------- +Parsing warnings + Combining multiple warnings +------------------------------------------------------------------------------- +CmdLine.tests.cpp:<line number> +............................................................................... + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) ) +with expansion: + {?} + +CmdLine.tests.cpp:<line number>: PASSED: + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ) +with expansion: + 3 == 3 + +------------------------------------------------------------------------------- Pointers can be compared to null ------------------------------------------------------------------------------- Condition.tests.cpp:<line number> @@ -17275,6 +17321,6 @@ Misc.tests.cpp:<line number> Misc.tests.cpp:<line number>: PASSED: =============================================================================== -test cases: 376 | 283 passed | 86 failed | 7 failed as expected -assertions: 2166 | 1993 passed | 146 failed | 27 failed as expected +test cases: 377 | 284 passed | 86 failed | 7 failed as expected +assertions: 2171 | 1998 passed | 146 failed | 27 failed as expected diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt index 0047eb70..49640ad3 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="129" tests="2166" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> + <testsuite name="<exe-name>" errors="17" failures="129" tests="2171" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}"> <properties> <property name="random-seed" value="1"/> <property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/> @@ -1070,6 +1070,9 @@ Message.tests.cpp:<line number> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/shard-index" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Negative shard index reports error" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Parsing sharding-related cli flags/Shard index 0 is accepted" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/NoAssertions" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/NoTests is no longer supported" time="{duration}" status="run"/> + <testcase classname="<exe-name>.global" name="Parsing warnings/Combining multiple warnings" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Pointers can be compared to null" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Precision of floating point stringification can be set/Floats" time="{duration}" status="run"/> <testcase classname="<exe-name>.global" name="Precision of floating point stringification can be set/Double" time="{duration}" status="run"/> diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt index e56652ce..dc1f7a54 100644 --- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt +++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt @@ -52,6 +52,9 @@ <testCase name="Parsing sharding-related cli flags/shard-index" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/Negative shard index reports error" duration="{duration}"/> <testCase name="Parsing sharding-related cli flags/Shard index 0 is accepted" duration="{duration}"/> + <testCase name="Parsing warnings/NoAssertions" duration="{duration}"/> + <testCase name="Parsing warnings/NoTests is no longer supported" duration="{duration}"/> + <testCase name="Parsing warnings/Combining multiple warnings" duration="{duration}"/> <testCase name="Process can be configured on command line/empty args don't cause a crash" duration="{duration}"/> <testCase name="Process can be configured on command line/default - no arguments" duration="{duration}"/> <testCase name="Process can be configured on command line/test lists/Specify one test case using" duration="{duration}"/> diff --git a/tests/SelfTest/Baselines/tap.sw.approved.txt b/tests/SelfTest/Baselines/tap.sw.approved.txt index 087064df..fe02346f 100644 --- a/tests/SelfTest/Baselines/tap.sw.approved.txt +++ b/tests/SelfTest/Baselines/tap.sw.approved.txt @@ -2322,6 +2322,16 @@ ok {test-number} - result.errorMessage(), ContainsSubstring("Shard index must be ok {test-number} - cli.parse({ "test", "--shard-index=0" }) for: {?} # Parsing sharding-related cli flags ok {test-number} - config.shardIndex == 0 for: 0 == 0 +# Parsing warnings +ok {test-number} - cli.parse( { "test", "-w", "NoAssertions" } ) for: {?} +# Parsing warnings +ok {test-number} - config.warnings == WarnAbout::NoAssertions for: 1 == 1 +# Parsing warnings +ok {test-number} - !(cli.parse( { "test", "-w", "NoTests" } )) for: !{?} +# Parsing warnings +ok {test-number} - cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) for: {?} +# Parsing warnings +ok {test-number} - config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) for: 3 == 3 # Pointers can be compared to null ok {test-number} - p == 0 for: 0 == 0 # Pointers can be compared to null @@ -4334,5 +4344,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0 ok {test-number} - # xmlentitycheck ok {test-number} - -1..2166 +1..2171 diff --git a/tests/SelfTest/Baselines/teamcity.sw.approved.txt b/tests/SelfTest/Baselines/teamcity.sw.approved.txt index 933ac413..b570833f 100644 --- a/tests/SelfTest/Baselines/teamcity.sw.approved.txt +++ b/tests/SelfTest/Baselines/teamcity.sw.approved.txt @@ -463,6 +463,8 @@ Message.tests.cpp:<line number>|nexplicit failure with message:|n "Message from ##teamcity[testFinished name='Parse test names and tags' duration="{duration}"] ##teamcity[testStarted name='Parsing sharding-related cli flags'] ##teamcity[testFinished name='Parsing sharding-related cli flags' duration="{duration}"] +##teamcity[testStarted name='Parsing warnings'] +##teamcity[testFinished name='Parsing warnings' duration="{duration}"] ##teamcity[testStarted name='Pointers can be compared to null'] ##teamcity[testFinished name='Pointers can be compared to null' duration="{duration}"] ##teamcity[testStarted name='Precision of floating point stringification can be set'] diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt index 008cd139..d09dde34 100644 --- a/tests/SelfTest/Baselines/xml.sw.approved.txt +++ b/tests/SelfTest/Baselines/xml.sw.approved.txt @@ -10679,6 +10679,58 @@ Nor would this </Section> <OverallResult success="true"/> </TestCase> + <TestCase name="Parsing warnings" tags="[cli][warnings]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Section name="NoAssertions" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse( { "test", "-w", "NoAssertions" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.warnings == WarnAbout::NoAssertions + </Original> + <Expanded> + 1 == 1 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <Section name="NoTests is no longer supported" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + !(cli.parse( { "test", "-w", "NoTests" } )) + </Original> + <Expanded> + !{?} + </Expanded> + </Expression> + <OverallResults successes="1" failures="0" expectedFailures="0"/> + </Section> + <Section name="Combining multiple warnings" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + cli.parse( { "test", "--warn", "NoAssertions", "--warn", "UnmatchedTestSpec" } ) + </Original> + <Expanded> + {?} + </Expanded> + </Expression> + <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" > + <Original> + config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) + </Original> + <Expanded> + 3 == 3 + </Expanded> + </Expression> + <OverallResults successes="2" failures="0" expectedFailures="0"/> + </Section> + <OverallResult success="true"/> + </TestCase> <TestCase name="Pointers can be compared to null" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Expression success="true" type="REQUIRE" filename="tests/<exe-name>/UsageTests/Condition.tests.cpp" > <Original> @@ -20238,6 +20290,6 @@ loose text artifact </Section> <OverallResult success="true"/> </TestCase> - <OverallResults successes="1993" failures="146" expectedFailures="27"/> - <OverallResultsCases successes="283" failures="86" expectedFailures="7"/> + <OverallResults successes="1998" failures="146" expectedFailures="27"/> + <OverallResultsCases successes="284" failures="86" expectedFailures="7"/> </Catch2TestRun> diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp index 332cbe50..16a77bc1 100644 --- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp +++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp @@ -618,6 +618,28 @@ TEST_CASE("Parsing sharding-related cli flags", "[sharding]") { } +TEST_CASE( "Parsing warnings", "[cli][warnings]" ) { + using Catch::WarnAbout; + + Catch::ConfigData config; + auto cli = Catch::makeCommandLineParser( config ); + + SECTION( "NoAssertions" ) { + REQUIRE(cli.parse( { "test", "-w", "NoAssertions" } )); + REQUIRE( config.warnings == WarnAbout::NoAssertions ); + } + SECTION( "NoTests is no longer supported" ) { + REQUIRE_FALSE(cli.parse( { "test", "-w", "NoTests" } )); + } + SECTION( "Combining multiple warnings" ) { + REQUIRE( cli.parse( { "test", + "--warn", "NoAssertions", + "--warn", "UnmatchedTestSpec" } ) ); + + REQUIRE( config.warnings == ( WarnAbout::NoAssertions | WarnAbout::UnmatchedTestSpec ) ); + } +} + TEST_CASE("Test with special, characters \"in name", "[cli][regression]") { // This test case succeeds if we can invoke it from the CLI SUCCEED(); |