mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-12 18:36:53 +00:00
Add even more tests
This commit is contained in:
@@ -653,4 +653,25 @@ bar
|
|||||||
yield ['{{ ({ a: 1) }}', '{'];
|
yield ['{{ ({ a: 1) }}', '{'];
|
||||||
yield ['{{ (([1]) + 3 }}', '('];
|
yield ['{{ (([1]) + 3 }}', '('];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @dataProvider getTemplateForUnexpectedBracketInExpression
|
||||||
|
*/
|
||||||
|
public function testUnexpectedBracketInExpression(string $template, string $bracket)
|
||||||
|
{
|
||||||
|
$lexer = new Lexer(new Environment(new ArrayLoader()));
|
||||||
|
|
||||||
|
$this->expectException(SyntaxError::class);
|
||||||
|
$this->expectExceptionMessage(\sprintf('Unexpected "%s" in "index" at line 1.', $bracket));
|
||||||
|
|
||||||
|
$lexer->tokenize(new Source($template, 'index'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getTemplateForUnexpectedBracketInExpression()
|
||||||
|
{
|
||||||
|
yield ['{{ 1 + 3) }}', ')'];
|
||||||
|
yield ['{{ obj] }}', ']'];
|
||||||
|
yield ['{{ { a: 1 }}', '}'];
|
||||||
|
yield ['{{ ([1] + 3)) }}', ')'];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user