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

@@ -197,6 +197,27 @@ Compilation.tests.cpp:<line number>: PASSED:
with expansion:
true
-------------------------------------------------------------------------------
#1905 -- test spec parser properly clears internal state between compound tests
-------------------------------------------------------------------------------
CmdLine.tests.cpp:<line number>
...............................................................................
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( spec.matches(*fakeTestCase("spec . char")) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE( spec.matches(*fakeTestCase("spec , char")) )
with expansion:
true
CmdLine.tests.cpp:<line number>: PASSED:
REQUIRE_FALSE( spec.matches(*fakeTestCase(R"(spec \, char)")) )
with expansion:
!false
-------------------------------------------------------------------------------
#748 - captures with unexpected exceptions
outside assertions
@@ -377,6 +398,6 @@ Condition.tests.cpp:<line number>: FAILED:
CHECK( true != true )
===============================================================================
test cases: 20 | 15 passed | 3 failed | 2 failed as expected
assertions: 43 | 36 passed | 4 failed | 3 failed as expected
test cases: 21 | 16 passed | 3 failed | 2 failed as expected
assertions: 46 | 39 passed | 4 failed | 3 failed as expected