Fix bug in test spec parser handling of escaping in ORed patterns

It did not clear out all of its internal state when switching from
one pattern to another, so when it should've escaped `,`, it took
its position from its position in the original user-provided string,
rather than its position in the current pattern.

Fixes #1905
This commit is contained in:
Martin Hořeňovský
2020-04-12 18:44:42 +02:00
parent ca27b0dcc5
commit 87a8b61d5a
12 changed files with 106 additions and 10 deletions

View File

@@ -202,6 +202,33 @@ Nor would this
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#1905 -- test spec parser properly clears internal state between compound tests" tags="[command-line][test-spec]" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
spec.matches(*fakeTestCase("spec . char"))
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
spec.matches(*fakeTestCase("spec , char"))
</Original>
<Expanded>
true
</Expanded>
</Expression>
<Expression success="true" type="REQUIRE_FALSE" filename="tests/<exe-name>/IntrospectiveTests/CmdLine.tests.cpp" >
<Original>
!(spec.matches(*fakeTestCase(R"(spec \, char)")))
</Original>
<Expanded>
!false
</Expanded>
</Expression>
<OverallResult success="true"/>
</TestCase>
<TestCase name="#748 - captures with unexpected exceptions" tags="[!shouldfail][!throws][.][failing]" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Section name="outside assertions" filename="tests/<exe-name>/UsageTests/Exception.tests.cpp" >
<Info>
@@ -17568,7 +17595,7 @@ loose text artifact
</Section>
<OverallResult success="true"/>
</TestCase>
<OverallResults successes="1721" failures="149" expectedFailures="21"/>
<OverallResults successes="1724" failures="149" expectedFailures="21"/>
</Group>
<OverallResults successes="1721" failures="148" expectedFailures="21"/>
<OverallResults successes="1724" failures="148" expectedFailures="21"/>
</Catch>