@@ -20,7 +20,8 @@ public void TokenizesFunctionElements()
20
20
{
21
21
const string text = @"
22
22
function Get-Sum {
23
- param( [int]$a, [int]$b )
23
+ param( [parameter()] [int]$a, [int]$b )
24
+ :loopLabel while (0) {break loopLabel}
24
25
return $a + $b
25
26
}
26
27
" ;
@@ -38,10 +39,21 @@ function Get-Sum {
38
39
case "function" :
39
40
case "param" :
40
41
case "return" :
42
+ case "while" :
43
+ case "break" :
41
44
Assert . Single ( mappedTokens , sToken => SemanticTokenType . Keyword == sToken . Type ) ;
42
45
break ;
43
- case "Get-Sum" :
44
- Assert . Single ( mappedTokens , sToken => SemanticTokenType . Function == sToken . Type ) ;
46
+ case "parameter" :
47
+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Decorator == sToken . Type ) ;
48
+ break ;
49
+ case "0" :
50
+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Number == sToken . Type ) ;
51
+ break ;
52
+ case ":loopLabel" :
53
+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Label == sToken . Type ) ;
54
+ break ;
55
+ case "loopLabel" :
56
+ Assert . Single ( mappedTokens , sToken => SemanticTokenType . Property == sToken . Type ) ;
45
57
break ;
46
58
case "$a" :
47
59
case "$b" :
@@ -74,7 +86,6 @@ public void TokenizesStringExpansion()
74
86
Token stringExpandableToken = scriptFile . ScriptTokens [ 1 ] ;
75
87
mappedTokens = new List < SemanticToken > ( PsesSemanticTokensHandler . ConvertToSemanticTokens ( stringExpandableToken ) ) ;
76
88
Assert . Collection ( mappedTokens ,
77
- sToken => Assert . Equal ( SemanticTokenType . Function , sToken . Type ) ,
78
89
sToken => Assert . Equal ( SemanticTokenType . Function , sToken . Type ) ,
79
90
sToken => Assert . Equal ( SemanticTokenType . Function , sToken . Type )
80
91
) ;
0 commit comments