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

summaryrefslogtreecommitdiffhomepage
path: root/projects/SelfTest
diff options
context:
space:
mode:
authorMartin Hořeňovský2019-09-09 11:30:45 +0200
committerMartin Hořeňovský2019-09-09 14:28:11 +0200
commitaf8b2538a62db34b3cec10ceb74e3d29bd06e37f (patch)
tree32069c3bf1662b5d50a78829584b3352458f238c /projects/SelfTest
parenta156440b19c1103419b6e4d3ebbfe3c7ddb948dc (diff)
downloadcatch3-af8b2538a62db34b3cec10ceb74e3d29bd06e37f.tar.gz
Ignore leading/trailing whitespace in test/section specs
The leading/trailing whitespace is problematic because of e.g. `WHEN` macro having preceeding whitespace for alignment, and it is generally messy. Credits to Phil who did lot of the original work. Closes #1708
Diffstat (limited to 'projects/SelfTest')
-rw-r--r--projects/SelfTest/Baselines/compact.sw.approved.txt10
-rw-r--r--projects/SelfTest/Baselines/console.std.approved.txt2
-rw-r--r--projects/SelfTest/Baselines/console.sw.approved.txt66
-rw-r--r--projects/SelfTest/Baselines/junit.sw.approved.txt4
-rw-r--r--projects/SelfTest/Baselines/xml.sw.approved.txt90
-rw-r--r--projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp17
6 files changed, 184 insertions, 5 deletions
diff --git a/projects/SelfTest/Baselines/compact.sw.approved.txt b/projects/SelfTest/Baselines/compact.sw.approved.txt
index fccf52ca..9a7abcef 100644
--- a/projects/SelfTest/Baselines/compact.sw.approved.txt
+++ b/projects/SelfTest/Baselines/compact.sw.approved.txt
@@ -866,6 +866,16 @@ CmdLine.tests.cpp:<line number>: passed: spec.matches( tcA ) == false for: false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcB ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcC ) == false for: false == false
CmdLine.tests.cpp:<line number>: passed: spec.matches( tcD ) == true for: true == 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( " 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( " 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( "aardvark " ) ) for: true
+CmdLine.tests.cpp:<line number>: passed: spec.matches( fakeTestCase( "aardvark" ) ) 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/projects/SelfTest/Baselines/console.std.approved.txt b/projects/SelfTest/Baselines/console.std.approved.txt
index a52bb9a5..d2b2165f 100644
--- a/projects/SelfTest/Baselines/console.std.approved.txt
+++ b/projects/SelfTest/Baselines/console.std.approved.txt
@@ -1381,5 +1381,5 @@ due to unexpected exception with message:
===============================================================================
test cases: 300 | 226 passed | 70 failed | 4 failed as expected
-assertions: 1558 | 1406 passed | 131 failed | 21 failed as expected
+assertions: 1568 | 1416 passed | 131 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/console.sw.approved.txt b/projects/SelfTest/Baselines/console.sw.approved.txt
index 1fca8cf3..6eabf307 100644
--- a/projects/SelfTest/Baselines/console.sw.approved.txt
+++ b/projects/SelfTest/Baselines/console.sw.approved.txt
@@ -6367,6 +6367,70 @@ with expansion:
true == true
-------------------------------------------------------------------------------
+Parse test names and tags
+ Leading and trailing spaces in test spec
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( " aardvark" ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( "aardvark " ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( "aardvark" ) ) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
+Parse test names and tags
+ Leading and trailing spaces in test name
+-------------------------------------------------------------------------------
+CmdLine.tests.cpp:<line number>
+...............................................................................
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( " aardvark" ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( "aardvark " ) ) )
+with expansion:
+ true
+
+CmdLine.tests.cpp:<line number>: PASSED:
+ CHECK( spec.matches( fakeTestCase( "aardvark" ) ) )
+with expansion:
+ true
+
+-------------------------------------------------------------------------------
Pointers can be compared to null
-------------------------------------------------------------------------------
Condition.tests.cpp:<line number>
@@ -12457,5 +12521,5 @@ Misc.tests.cpp:<line number>: PASSED:
===============================================================================
test cases: 300 | 210 passed | 86 failed | 4 failed as expected
-assertions: 1575 | 1406 passed | 148 failed | 21 failed as expected
+assertions: 1585 | 1416 passed | 148 failed | 21 failed as expected
diff --git a/projects/SelfTest/Baselines/junit.sw.approved.txt b/projects/SelfTest/Baselines/junit.sw.approved.txt
index ca1998ed..e764d1f6 100644
--- a/projects/SelfTest/Baselines/junit.sw.approved.txt
+++ b/projects/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="1576" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
+ <testsuite name="<exe-name>" errors="17" failures="132" tests="1586" hostname="tbd" time="{duration}" timestamp="{iso8601-timestamp}">
<properties>
<property name="filters" value="~[!nonportable]~[!benchmark]~[approvals]"/>
<property name="random-seed" value="1"/>
@@ -620,6 +620,8 @@ Message.tests.cpp:<line number>
<testcase classname="<exe-name>.global" name="Parse test names and tags/empty tag" time="{duration}"/>
<testcase classname="<exe-name>.global" name="Parse test names and tags/empty quoted name" time="{duration}"/>
<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="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/projects/SelfTest/Baselines/xml.sw.approved.txt b/projects/SelfTest/Baselines/xml.sw.approved.txt
index c406d061..b58684d7 100644
--- a/projects/SelfTest/Baselines/xml.sw.approved.txt
+++ b/projects/SelfTest/Baselines/xml.sw.approved.txt
@@ -7901,6 +7901,92 @@ Nor would this
</Expression>
<OverallResults successes="5" failures="0" expectedFailures="0"/>
</Section>
+ <Section name="Leading and trailing spaces in test spec" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( " aardvark " ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( " aardvark" ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( " aardvark " ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( "aardvark " ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( "aardvark" ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
+ <Section name="Leading and trailing spaces in test name" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( " aardvark " ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( " aardvark" ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( " aardvark " ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( "aardvark " ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <Expression success="true" type="CHECK" filename="projects/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
+ <Original>
+ spec.matches( fakeTestCase( "aardvark" ) )
+ </Original>
+ <Expanded>
+ true
+ </Expanded>
+ </Expression>
+ <OverallResults successes="5" failures="0" expectedFailures="0"/>
+ </Section>
<OverallResult success="true"/>
</TestCase>
<TestCase name="Pointers can be compared to null" filename="projects/<exe-name>/UsageTests/Condition.tests.cpp" >
@@ -14826,7 +14912,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
- <OverallResults successes="1406" failures="149" expectedFailures="21"/>
+ <OverallResults successes="1416" failures="149" expectedFailures="21"/>
</Group>
- <OverallResults successes="1406" failures="148" expectedFailures="21"/>
+ <OverallResults successes="1416" failures="148" expectedFailures="21"/>
</Catch>
diff --git a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
index f4d1299a..6ecc3a14 100644
--- a/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
+++ b/projects/SelfTest/IntrospectiveTests/CmdLine.tests.cpp
@@ -262,7 +262,24 @@ TEST_CASE( "Parse test names and tags" ) {
CHECK( spec.matches( tcC ) == false );
CHECK( spec.matches( tcD ) == true );
}
+ SECTION( "Leading and trailing spaces in test spec" ) {
+ TestSpec spec = parseTestSpec( "\" aardvark \"" );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark" ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark" ) ) );
+ }
+ SECTION( "Leading and trailing spaces in test name" ) {
+ TestSpec spec = parseTestSpec( "aardvark" );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark" ) ) );
+ CHECK( spec.matches( fakeTestCase( " aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark " ) ) );
+ CHECK( spec.matches( fakeTestCase( "aardvark" ) ) );
+
+ }
}
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {