@@ -317,6 +317,22 @@ describe 'PHP grammar', ->
317
317
expect (tokens[9 ]).toEqual value : ' :' , scopes : [" source.php" , " keyword.operator.ternary.php" ]
318
318
expect (tokens[12 ]).toEqual value : ' ::' , scopes : [" source.php" , " keyword.operator.class.php" ]
319
319
320
+ it ' should NOT tokenize goto label in ternary' , ->
321
+ # See https://github.com/atom/language-php/issues/386
322
+ lines = grammar .tokenizeLines '''
323
+ $a ?
324
+ null :
325
+ $b
326
+ '''
327
+
328
+ expect (lines[0 ][0 ]).toEqual value : ' $' , scopes : [' source.php' , ' variable.other.php' , ' punctuation.definition.variable.php' ]
329
+ expect (lines[0 ][1 ]).toEqual value : ' a' , scopes : [' source.php' , ' variable.other.php' ]
330
+ expect (lines[0 ][3 ]).toEqual value : ' ?' , scopes : [' source.php' , ' keyword.operator.ternary.php' ]
331
+ expect (lines[1 ][1 ]).toEqual value : ' null' , scopes : [' source.php' , ' constant.language.php' ]
332
+ expect (lines[1 ][3 ]).toEqual value : ' :' , scopes : [' source.php' , ' keyword.operator.ternary.php' ]
333
+ expect (lines[2 ][1 ]).toEqual value : ' $' , scopes : [' source.php' , ' variable.other.php' , ' punctuation.definition.variable.php' ]
334
+ expect (lines[2 ][2 ]).toEqual value : ' b' , scopes : [' source.php' , ' variable.other.php' ]
335
+
320
336
describe ' identifiers' , ->
321
337
it ' tokenizes identifiers with only letters' , ->
322
338
{tokens } = grammar .tokenizeLine ' $abc'
0 commit comments