[Yaml] Clean some messages + add test case
This commit is contained in:
parent
620ea20f49
commit
7520f7b937
@ -249,7 +249,7 @@ class Inline
|
||||
$output = $match[1];
|
||||
$i += strlen($output);
|
||||
} else {
|
||||
throw new ParseException(sprintf('Malformed inline YAML string (%s).', $scalar));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $scalar));
|
||||
}
|
||||
|
||||
if ($evaluate) {
|
||||
@ -273,7 +273,7 @@ class Inline
|
||||
private static function parseQuotedScalar($scalar, &$i)
|
||||
{
|
||||
if (!preg_match('/'.self::REGEX_QUOTED_STRING.'/Au', substr($scalar, $i), $match)) {
|
||||
throw new ParseException(sprintf('Malformed inline YAML string (%s).', substr($scalar, $i)));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', substr($scalar, $i)));
|
||||
}
|
||||
|
||||
$output = substr($match[0], 1, strlen($match[0]) - 2);
|
||||
@ -346,7 +346,7 @@ class Inline
|
||||
++$i;
|
||||
}
|
||||
|
||||
throw new ParseException(sprintf('Malformed inline YAML string %s', $sequence));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $sequence));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -434,7 +434,7 @@ class Inline
|
||||
}
|
||||
}
|
||||
|
||||
throw new ParseException(sprintf('Malformed inline YAML string %s', $mapping));
|
||||
throw new ParseException(sprintf('Malformed inline YAML string: %s.', $mapping));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -401,4 +401,13 @@ class InlineTest extends \PHPUnit_Framework_TestCase
|
||||
array('{ foo: { bar: { 1: 2, baz: 3 } } }', array('foo' => array('bar' => array(1 => 2, 'baz' => 3)))),
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Symfony\Component\Yaml\Exception\ParseException
|
||||
* @expectedExceptionMessage Malformed inline YAML string: {this, is not, supported}.
|
||||
*/
|
||||
public function testNotSupportedMissingValue()
|
||||
{
|
||||
Inline::parse('{this, is not, supported}');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user