Skip to content

Commit

Permalink
[Yaml] simplify the test
Browse files Browse the repository at this point in the history
  • Loading branch information
xabbuh committed Sep 18, 2020
1 parent a2b5a78 commit ec3c2ac
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions Tests/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2381,19 +2381,13 @@ public function testParsingMultipleDocuments()
c: d
YAML;

$expected = ['a' => ['b' => "row\nrow2\n"], 'c' => 'd'];

// The parser was not used before, so there is a new line after row2
$this->assertSame($expected, $this->parser->parse($longDocument));

$parser = new Parser();
// The first parsing set and fixed the totalNumberOfLines in the Parser before, so parsing the short document here
// to reproduce the issue. If the issue would not have been fixed, the next assertion will fail
$parser->parse($shortDocument);
$this->parser->parse($shortDocument);

// After the total number of lines has been rset the result will be the same as if a new parser was used
// After the total number of lines has been reset the result will be the same as if a new parser was used
// (before, there was no \n after row2)
$this->assertSame($expected, $parser->parse($longDocument));
$this->assertSame(['a' => ['b' => "row\nrow2\n"], 'c' => 'd'], $this->parser->parse($longDocument));
}
}

Expand Down

0 comments on commit ec3c2ac

Please sign in to comment.