update v1.0.7.9 R.C.
This is a Release Candidate. We are still testing.
This commit is contained in:
87
vendor/symfony/yaml/Tests/ParserTest.php
vendored
87
vendor/symfony/yaml/Tests/ParserTest.php
vendored
@@ -693,6 +693,25 @@ EOT;
|
||||
$this->assertSame($expected, $this->parser->parse($yaml));
|
||||
}
|
||||
|
||||
public function testSequenceFollowedByCommentEmbeddedInMapping()
|
||||
{
|
||||
$yaml = <<<EOT
|
||||
a:
|
||||
b:
|
||||
- c
|
||||
# comment
|
||||
d: e
|
||||
EOT;
|
||||
$expected = array(
|
||||
'a' => array(
|
||||
'b' => array('c'),
|
||||
'd' => 'e',
|
||||
),
|
||||
);
|
||||
|
||||
$this->assertSame($expected, $this->parser->parse($yaml));
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
*/
|
||||
@@ -1243,6 +1262,74 @@ EOT;
|
||||
|
||||
$this->assertEquals(array('date' => $expectedDate), $this->parser->parse($yaml, Yaml::PARSE_DATETIME));
|
||||
}
|
||||
|
||||
/**
|
||||
* @param $lineNumber
|
||||
* @param $yaml
|
||||
* @dataProvider parserThrowsExceptionWithCorrectLineNumberProvider
|
||||
*/
|
||||
public function testParserThrowsExceptionWithCorrectLineNumber($lineNumber, $yaml)
|
||||
{
|
||||
$this->setExpectedException(
|
||||
'\Symfony\Component\Yaml\Exception\ParseException',
|
||||
sprintf('Unexpected characters near "," at line %d (near "bar: "123",").', $lineNumber)
|
||||
);
|
||||
|
||||
$this->parser->parse($yaml);
|
||||
}
|
||||
|
||||
public function parserThrowsExceptionWithCorrectLineNumberProvider()
|
||||
{
|
||||
return array(
|
||||
array(
|
||||
4,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
5,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# bar
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
8,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
baz: 123
|
||||
bar:
|
||||
-
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
array(
|
||||
10,
|
||||
<<<YAML
|
||||
foo:
|
||||
-
|
||||
# foobar
|
||||
# foobar
|
||||
baz: 123
|
||||
bar:
|
||||
-
|
||||
# bar
|
||||
# bar
|
||||
bar: "123",
|
||||
YAML
|
||||
),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class B
|
||||
|
Reference in New Issue
Block a user