mirror of
https://github.com/catchorg/Catch2.git
synced 2025-08-01 12:55:40 +02:00
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:
@@ -296,6 +296,17 @@ TEST_CASE( "Parse test names and tags", "[command-line][test-spec]" ) {
|
||||
}
|
||||
}
|
||||
|
||||
TEST_CASE("#1905 -- test spec parser properly clears internal state between compound tests", "[command-line][test-spec]") {
|
||||
using Catch::parseTestSpec;
|
||||
using Catch::TestSpec;
|
||||
// We ask for one of 2 different tests and the latter one of them has a , in name that needs escaping
|
||||
TestSpec spec = parseTestSpec(R"("spec . char","spec \, char")");
|
||||
|
||||
REQUIRE(spec.matches(*fakeTestCase("spec . char")));
|
||||
REQUIRE(spec.matches(*fakeTestCase("spec , char")));
|
||||
REQUIRE_FALSE(spec.matches(*fakeTestCase(R"(spec \, char)")));
|
||||
}
|
||||
|
||||
TEST_CASE( "Process can be configured on command line", "[config][command-line]" ) {
|
||||
|
||||
using namespace Catch::Matchers;
|
||||
|
Reference in New Issue
Block a user