-
-
Notifications
You must be signed in to change notification settings - Fork 131
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix lexing strings containing escaped quotation characters
- Loading branch information
Showing
2 changed files
with
91 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1570,6 +1570,54 @@ public function testParseMultiLineUnquotedString() | |
$this->assertSame(['foo' => 'bar baz foobar foo', 'bar' => 'baz'], $this->parser->parse($yaml)); | ||
} | ||
|
||
/** | ||
* @dataProvider escapedQuotationCharactersInQuotedStrings | ||
*/ | ||
public function testParseQuotedStringContainingEscapedQuotationCharacters(string $yaml, array $expected) | ||
{ | ||
$this->assertSame($expected, $this->parser->parse($yaml)); | ||
} | ||
|
||
public function escapedQuotationCharactersInQuotedStrings() | ||
{ | ||
return [ | ||
'single quoted string' => [ | ||
<<<YAML | ||
entries: | ||
- message: 'No emails received before timeout - Address: ''[email protected]'' | ||
Keyword: ''Your Order confirmation'' ttl: 50' | ||
outcome: failed | ||
YAML | ||
, | ||
[ | ||
'entries' => [ | ||
[ | ||
'message' => 'No emails received before timeout - Address: \'[email protected]\' Keyword: \'Your Order confirmation\' ttl: 50', | ||
'outcome' => 'failed', | ||
], | ||
], | ||
], | ||
], | ||
'double quoted string' => [ | ||
<<<YAML | ||
entries: | ||
- message: "No emails received before timeout - Address: \"[email protected]\" | ||
Keyword: \"Your Order confirmation\" ttl: 50" | ||
outcome: failed | ||
YAML | ||
, | ||
[ | ||
'entries' => [ | ||
[ | ||
'message' => 'No emails received before timeout - Address: "[email protected]" Keyword: "Your Order confirmation" ttl: 50', | ||
'outcome' => 'failed', | ||
], | ||
], | ||
], | ||
], | ||
]; | ||
} | ||
|
||
public function testParseMultiLineString() | ||
{ | ||
$this->assertEquals("foo bar\nbaz", $this->parser->parse("foo\nbar\n\nbaz")); | ||
|