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ý2019-11-05 23:28:47 +0100
committerMartin Hořeňovský2020-02-13 13:35:10 +0100
commitc50ba09cdef4e9d8764868a1a67f0ec3850b5d04 (patch)
tree0612abe0b87c85be5109f7445cbaaf09cc784b71 /tests/SelfTest
parentc165bd15c5017137db38e149c8c8b68f1233fa96 (diff)
downloadcatch3-c50ba09cdef4e9d8764868a1a67f0ec3850b5d04.tar.gz
Split [.foo] into [.][foo] when parsing test specs
b77cec05c0 fixed this problem for tagging tests, so that a test case tagged with `[.foo]` would be parsed as tagged with `[.][foo]`. This does the same for the test spec parsing. Fixes #1798
Diffstat (limited to 'tests/SelfTest')
-rw-r--r--tests/SelfTest/Baselines/compact.sw.approved.txt6
-rw-r--r--tests/SelfTest/Baselines/console.std.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/console.sw.approved.txt46
-rw-r--r--tests/SelfTest/Baselines/junit.sw.approved.txt4
-rw-r--r--tests/SelfTest/Baselines/sonarqube.sw.approved.txt2
-rw-r--r--tests/SelfTest/Baselines/tap.sw.approved.txt22
-rw-r--r--tests/SelfTest/Baselines/xml.sw.approved.txt60
-rw-r--r--tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp15
8 files changed, 144 insertions, 13 deletions
diff --git a/tests/SelfTest/Baselines/compact.sw.approved.txt b/tests/SelfTest/Baselines/compact.sw.approved.txt
index 5f9e6a9f..9dc81ad4 100644
--- a/tests/SelfTest/Baselines/compact.sw.approved.txt
+++ b/tests/SelfTest/Baselines/compact.sw.approved.txt
@@ -1028,6 +1028,12 @@ CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvar
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( " aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark " ) ) for: true
CmdLine.tests.cpp:<line number>: passed: spec.matches( *fakeTestCase( "aardvark" ) ) for: true
+CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true
+CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false
+CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false
+CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false
+CmdLine.tests.cpp:<line number>: passed: !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false
+CmdLine.tests.cpp:<line number>: passed: spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true
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 140a0b8a..fe6e4f14 100644
--- a/tests/SelfTest/Baselines/console.std.approved.txt
+++ b/tests/SelfTest/Baselines/console.std.approved.txt
@@ -1381,5 +1381,5 @@ due to unexpected exception with message:
===============================================================================
test cases: 320 | 246 passed | 70 failed | 4 failed as expected
-assertions: 1776 | 1624 passed | 131 failed | 21 failed as expected
+assertions: 1782 | 1630 passed | 131 failed | 21 failed as expected
diff --git a/tests/SelfTest/Baselines/console.sw.approved.txt b/tests/SelfTest/Baselines/console.sw.approved.txt
index ea8481d2..bba11da2 100644
--- a/tests/SelfTest/Baselines/console.sw.approved.txt
+++ b/tests/SelfTest/Baselines/console.sw.approved.txt
@@ -7371,6 +7371,50 @@ with expansion:
true
-------------------------------------------------------------------------------
+Parse test names and tags
+ Shortened hide tags are split apart when parsing
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) )
+with expansion:
+ !false
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Shortened hide tags also properly handle exclusion
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK_FALSE( spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) )
+with expansion:
+ !false
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK_FALSE( spec.matches(*fakeTestCase("only foo", "[foo]")) )
+with expansion:
+ !false
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK_FALSE( spec.matches(*fakeTestCase("only hidden", "[.]")) )
+with expansion:
+ !false
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
Pointers can be compared to null
-------------------------------------------------------------------------------
Condition.tests.cpp:<line number>
@@ -13961,5 +14005,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 320 | 230 passed | 86 failed | 4 failed as expected
-assertions: 1793 | 1624 passed | 148 failed | 21 failed as expected
+assertions: 1799 | 1630 passed | 148 failed | 21 failed as expected
diff --git a/tests/SelfTest/Baselines/junit.sw.approved.txt b/tests/SelfTest/Baselines/junit.sw.approved.txt
index 336b7a79..f2537378 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="132" tests="1794" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="1800" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals] *"/>
<property name="random-seed" value="1"/>
@@ -983,6 +983,8 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Parse test names and tags/quoted string followed by tag exclusion" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test spec" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Parse test names and tags/Leading and trailing spaces in test name" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags are split apart when parsing" time="{duration}"/>
+ <testcase classname="<exe-name>.global" name="Parse test names and tags/Shortened hide tags also properly handle exclusion" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Pointers can be compared to null" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Precision of floating point stringification can be set/Floats" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Precision of floating point stringification can be set/Double" time="{duration}"/>
diff --git a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
index b54c147b..fa9e2a57 100644
--- a/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
+++ b/tests/SelfTest/Baselines/sonarqube.sw.approved.txt
@@ -35,6 +35,8 @@
<testCase name="Parse test names and tags/quoted string followed by tag exclusion" duration="{duration}"/>
<testCase name="Parse test names and tags/Leading and trailing spaces in test spec" duration="{duration}"/>
<testCase name="Parse test names and tags/Leading and trailing spaces in test name" duration="{duration}"/>
+ <testCase name="Parse test names and tags/Shortened hide tags are split apart when parsing" duration="{duration}"/>
+ <testCase name="Parse test names and tags/Shortened hide tags also properly handle exclusion" 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 1e679cec..1bf32291 100644
--- a/tests/SelfTest/Baselines/tap.sw.approved.txt
+++ b/tests/SelfTest/Baselines/tap.sw.approved.txt
@@ -1978,6 +1978,18 @@ ok {test-number} - spec.matches( *fakeTestCase( " aardvark " ) ) for: true
ok {test-number} - spec.matches( *fakeTestCase( "aardvark " ) ) for: true
# Parse test names and tags
ok {test-number} - spec.matches( *fakeTestCase( "aardvark" ) ) for: true
+# Parse test names and tags
+ok {test-number} - spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")) for: true
+# Parse test names and tags
+ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false
+# Parse test names and tags
+ok {test-number} - !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))) for: !false
+# Parse test names and tags
+ok {test-number} - !(spec.matches(*fakeTestCase("only foo", "[foo]"))) for: !false
+# Parse test names and tags
+ok {test-number} - !(spec.matches(*fakeTestCase("only hidden", "[.]"))) for: !false
+# Parse test names and tags
+ok {test-number} - spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")) for: true
# Pointers can be compared to null
ok {test-number} - p == 0 for: 0 == 0
# Pointers can be compared to null
@@ -2928,9 +2940,9 @@ not ok {test-number} - unexpected exception with message: 'expected exception';
# When unchecked exceptions are thrown from sections they are always failures
not ok {test-number} - unexpected exception with message: 'unexpected exception'
# Where the LHS is not a simple value
-warning 1461 - 'Uncomment the code in this test to check that it gives a sensible compiler error'
+warning 1467 - 'Uncomment the code in this test to check that it gives a sensible compiler error'
# Where there is more to the expression after the RHS
-warning 1462 - 'Uncomment the code in this test to check that it gives a sensible compiler error'
+warning 1468 - 'Uncomment the code in this test to check that it gives a sensible compiler error'
# X/level/0/a
ok {test-number} -
# X/level/0/b
@@ -3197,9 +3209,9 @@ ok {test-number} - s.result == 17 for: 17 == 17
# measure
ok {test-number} - s.iterations == 1 for: 1 == 1
# mix info, unscoped info and warning
-warning 1595 - 'info' with 2 messages: 'unscoped info' and 'and warn may mix'
+warning 1601 - 'info' with 2 messages: 'unscoped info' and 'and warn may mix'
# mix info, unscoped info and warning
-warning 1596 - 'info' with 2 messages: 'unscoped info' and 'they are not cleared after warnings'
+warning 1602 - 'info' with 2 messages: 'unscoped info' and 'they are not cleared after warnings'
# more nested SECTION tests
not ok {test-number} - a == b for: 1 == 2
# more nested SECTION tests
@@ -3578,5 +3590,5 @@ ok {test-number} - q3 == 23. for: 23.0 == 23.0
ok {test-number} -
# xmlentitycheck
ok {test-number} -
-1..1785
+1..1791
diff --git a/tests/SelfTest/Baselines/xml.sw.approved.txt b/tests/SelfTest/Baselines/xml.sw.approved.txt
index a27f88e5..39122b05 100644
--- a/tests/SelfTest/Baselines/xml.sw.approved.txt
+++ b/tests/SelfTest/Baselines/xml.sw.approved.txt
@@ -8025,7 +8025,7 @@ Nor would this
</Section>
<OverallResult success="false"/>
</TestCase>
- <TestCase name="Parse test names and tags" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <TestCase name="Parse test names and tags" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Section name="Empty test spec should have no filters" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
@@ -9285,6 +9285,60 @@ Nor would this
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0"/>
</Section>
+ <Section name="Shortened hide tags are split apart when parsing" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches(*fakeTestCase("hidden and foo", "[.][foo]"))
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ !(spec.matches(*fakeTestCase("only foo", "[foo]")))
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <OverallResults successes="2" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Shortened hide tags also properly handle exclusion" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ !(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")))
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ !(spec.matches(*fakeTestCase("only foo", "[foo]")))
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ !(spec.matches(*fakeTestCase("only hidden", "[.]")))
+ </Original>
+ <Expanded>
+ !false
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]"))
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="4" 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" >
@@ -16841,7 +16895,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1624" failures="149" expectedFailures="21"/>
+ <OverallResults successes="1630" failures="149" expectedFailures="21"/>
</Group>
- <OverallResults successes="1624" failures="148" expectedFailures="21"/>
+ <OverallResults successes="1630" failures="148" expectedFailures="21"/>
</Catch>
diff --git a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index bff30f2c..68dafad1 100644
--- a/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/tests/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -19,7 +19,7 @@ namespace {
auto fakeTestCase(const char* name, const char* desc = "") { return Catch::makeTestCaseInfo("", { name, desc }, CATCH_INTERNAL_LINEINFO); }
}
-TEST_CASE( "Parse test names and tags" ) {
+TEST_CASE( "Parse test names and tags", "[command-line][test-spec]" ) {
using Catch::parseTestSpec;
using Catch::TestSpec;
@@ -280,7 +280,18 @@ TEST_CASE( "Parse test names and tags" ) {
CHECK( spec.matches( *fakeTestCase( " aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark " ) ) );
CHECK( spec.matches( *fakeTestCase( "aardvark" ) ) );
-
+ }
+ SECTION("Shortened hide tags are split apart when parsing") {
+ TestSpec spec = parseTestSpec("[.foo]");
+ CHECK(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")));
+ CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]")));
+ }
+ SECTION("Shortened hide tags also properly handle exclusion") {
+ TestSpec spec = parseTestSpec("~[.foo]");
+ CHECK_FALSE(spec.matches(*fakeTestCase("hidden and foo", "[.][foo]")));
+ CHECK_FALSE(spec.matches(*fakeTestCase("only foo", "[foo]")));
+ CHECK_FALSE(spec.matches(*fakeTestCase("only hidden", "[.]")));
+ CHECK(spec.matches(*fakeTestCase("neither foo nor hidden", "[bar]")));
}
}