8000 [ExpressionLanguage] Cover multiline comments · symfony/symfony@3a0ba4b · GitHub
[go: up one dir, main page]

Skip to content

Commit 3a0ba4b

Browse files
[ExpressionLanguage] Cover multiline comments
1 parent 9d89e05 commit 3a0ba4b

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/Symfony/Component/ExpressionLanguage/Tests/LexerTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,32 @@ public function testTokenize($tokens, $expression)
3535
$this->assertEquals(new TokenStream($tokens, $expression), $this->lexer->tokenize($expression));
3636
}
3737

38+
public function testTokenizeMultilineComment()
39+
{
40+
$expression = <<<EXPRESSION
41+
/**
42+
* This is 2^16, even if we could have
43+
* used the hexadecimal representation 0x10000. Just a
44+
* matter of taste! 🙂
45+
*/
46+
65536 and
47+
/*
48+
This time, only one star to start the comment and that's it.
49+
It is valid too!
50+
*/
51+
65535 /* this is 2^16 - 1 */
52+
EXPRESSION;
53+
54+
$tokens = [
55+
new Token('number', 65536, 128),
56+
new Token('operator', 'and', 134),
57+
new Token('number', 65535, 225),
58+
new Token('end of expression', null, \strlen($expression) + 1),
59+
];
60+
61+
$this->assertEquals(new TokenStream($tokens, str_replace("\n", ' ', $expression)), $this->lexer->tokenize($expression));
62+
}
63+
3864
public function testTokenizeThrowsErrorWithMessage()
3965
{
4066
$this->expectException(SyntaxError::class);

0 commit comments

Comments
 (0)
0