@@ -177,5 +177,81 @@ describe("Attributes", () => {
177
177
Token . Punctuation . CloseParen ,
178
178
Token . Punctuation . CloseBracket ] ) ;
179
179
} ) ;
180
+
181
+ it ( "Generic attributes should be highlighted single type parameter" , async ( ) => {
182
+
183
+ const input = `[Foo<T1>]` ;
184
+ const tokens = await tokenize ( input ) ;
185
+
186
+ tokens . should . deep . equal ( [
187
+ Token . Punctuation . OpenBracket ,
188
+ Token . Type ( "Foo" ) ,
189
+ Token . Punctuation . TypeParameter . Begin ,
190
+ Token . Type ( "T1" ) ,
191
+ Token . Punctuation . TypeParameter . End ,
192
+ Token . Punctuation . CloseBracket ] ) ;
193
+ } ) ;
194
+
195
+ it ( "Generic attributes should be highlighted multiple type parameters" , async ( ) => {
196
+
197
+ const input = `[Foo<T1, T2>]` ;
198
+ const tokens = await tokenize ( input ) ;
199
+
200
+ tokens . should . deep . equal ( [
201
+ Token . Punctuation . OpenBracket ,
202
+ Token . Type ( "Foo" ) ,
203
+ Token . Punctuation . TypeParameter . Begin ,
204
+ Token . Type ( "T1" ) ,
205
+ Token . Punctuation . Comma ,
206
+ Token . Type ( "T2" ) ,
207
+ Token . Punctuation . TypeParameter . End ,
208
+ Token . Punctuation . CloseBracket ] ) ;
209
+ } ) ;
210
+
211
+ it ( "Generic attributes should be highlighted multiple type parameters with regular arguments" , async ( ) => {
212
+
213
+ const input = `[Foo<T1, T2>(true)]` ;
214
+ const tokens = await tokenize ( input ) ;
215
+
216
+ tokens . should . deep . equal ( [
217
+ Token . Punctuation . OpenBracket ,
218
+ Token . Type ( "Foo" ) ,
219
+ Token . Punctuation . TypeParameter . Begin ,
220
+ Token . Type ( "T1" ) ,
221
+ Token . Punctuation . Comma ,
222
+ Token . Type ( "T2" ) ,
223
+ Token . Punctuation . TypeParameter . End ,
224
+ Token . Punctuation . OpenParen ,
225
+ Token . Literal . Boolean . True ,
226
+ Token . Punctuation . CloseParen ,
227
+ Token . Punctuation . CloseBracket ] ) ;
228
+ } ) ;
229
+
230
+ it ( "Generic attributes should be highlighted empty" , async ( ) => {
231
+
232
+ const input = `[Foo<>]` ;
233
+ const tokens = await tokenize ( input ) ;
234
+
235
+ tokens . should . deep . equal ( [
236
+ Token . Punctuation . OpenBracket ,
237
+ Token . Type ( "Foo" ) ,
238
+ Token . Punctuation . TypeParameter . Begin ,
239
+ Token . Punctuation . TypeParameter . End ,
240
+ Token . Punctuation . CloseBracket ] ) ;
241
+ } ) ;
242
+
243
+ it ( "Generic attributes should be highlighted empty with comma" , async ( ) => {
244
+
245
+ const input = `[Foo<,>]` ;
246
+ const tokens = await tokenize ( input ) ;
247
+
248
+ tokens . should . deep . equal ( [
249
+ Token . Punctuation . OpenBracket ,
250
+ Token . Type ( "Foo" ) ,
251
+ Token . Punctuation . TypeParameter . Begin ,
252
+ Token . Punctuation . Comma ,
253
+ Token . Punctuation . TypeParameter . End ,
254
+ Token . Punctuation . CloseBracket ] ) ;
255
+ } ) ;
180
256
} ) ;
181
- } ) ;
257
+ } ) ;
0 commit comments