You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test/comment.tests.ts
+130
Original file line number
Diff line number
Diff line change
@@ -310,5 +310,135 @@ event EventHandler E {
310
310
Token.Comment.SingleLine.Text(" comment2"),
311
311
Token.Punctuation.CloseBrace]);
312
312
});
313
+
314
+
it("after try (issue #60)",()=>{
315
+
constinput=Input.InMethod(`
316
+
try //comment
317
+
{
318
+
}
319
+
finally
320
+
{
321
+
}
322
+
`);
323
+
consttokens=tokenize(input);
324
+
325
+
tokens.should.deep.equal([
326
+
Token.Keywords.Control.Try,
327
+
Token.Comment.SingleLine.Start,
328
+
Token.Comment.SingleLine.Text("comment"),
329
+
Token.Punctuation.OpenBrace,
330
+
Token.Punctuation.CloseBrace,
331
+
Token.Keywords.Control.Finally,
332
+
Token.Punctuation.OpenBrace,
333
+
Token.Punctuation.CloseBrace]);
334
+
});
335
+
336
+
it("after finally (issue #60)",()=>{
337
+
constinput=Input.InMethod(`
338
+
try
339
+
{
340
+
}
341
+
finally //comment
342
+
{
343
+
}
344
+
`);
345
+
consttokens=tokenize(input);
346
+
347
+
tokens.should.deep.equal([
348
+
Token.Keywords.Control.Try,
349
+
Token.Punctuation.OpenBrace,
350
+
Token.Punctuation.CloseBrace,
351
+
Token.Keywords.Control.Finally,
352
+
Token.Comment.SingleLine.Start,
353
+
Token.Comment.SingleLine.Text("comment"),
354
+
Token.Punctuation.OpenBrace,
355
+
Token.Punctuation.CloseBrace]);
356
+
});
357
+
358
+
it("after catch (issue #60)",()=>{
359
+
constinput=Input.InMethod(`
360
+
try
361
+
{
362
+
}
363
+
catch //comment
364
+
{
365
+
}
366
+
`);
367
+
consttokens=tokenize(input);
368
+
369
+
tokens.should.deep.equal([
370
+
Token.Keywords.Control.Try,
371
+
Token.Punctuation.OpenBrace,
372
+
Token.Punctuation.CloseBrace,
373
+
Token.Keywords.Control.Catch,
374
+
Token.Comment.SingleLine.Start,
375
+
Token.Comment.SingleLine.Text("comment"),
376
+
Token.Punctuation.OpenBrace,
377
+
Token.Punctuation.CloseBrace]);
378
+
});
379
+
380
+
it("after catch with exception (issue #60)",()=>{
381
+
constinput=Input.InMethod(`
382
+
try
383
+
{
384
+
}
385
+
catch (Exception) //comment
386
+
{
387
+
}
388
+
`);
389
+
consttokens=tokenize(input);
390
+
391
+
tokens.should.deep.equal([
392
+
Token.Keywords.Control.Try,
393
+
Token.Punctuation.OpenBrace,
394
+
Token.Punctuation.CloseBrace,
395
+
Token.Keywords.Control.Catch,
396
+
Token.Punctuation.OpenParen,
397
+
Token.Type("Exception"),
398
+
Token.Punctuation.CloseParen,
399
+
Token.Comment.SingleLine.Start,
400
+
Token.Comment.SingleLine.Text("comment"),
401
+
Token.Punctuation.OpenBrace,
402
+
Token.Punctuation.CloseBrace]);
403
+
});
404
+
405
+
it("after exception filter (issue #60)",()=>{
406
+
constinput=Input.InMethod(`
407
+
try
408
+
{
409
+
}
410
+
catch (DataNotFoundException dnfe) when (dnfe.GetType() == typeof(DataNotFoundException)) //Only catch exceptions that are distinctly DataNotFoundException
411
+
{
412
+
}
413
+
`);
414
+
consttokens=tokenize(input);
415
+
416
+
tokens.should.deep.equal([
417
+
Token.Keywords.Control.Try,
418
+
Token.Punctuation.OpenBrace,
419
+
Token.Punctuation.CloseBrace,
420
+
Token.Keywords.Control.Catch,
421
+
Token.Punctuation.OpenParen,
422
+
Token.Type("DataNotFoundException"),
423
+
Token.Identifiers.LocalName("dnfe"),
424
+
Token.Punctuation.CloseParen,
425
+
Token.Keywords.Control.When,
426
+
Token.Punctuation.OpenParen,
427
+
Token.Variables.Object("dnfe"),
428
+
Token.Punctuation.Accessor,
429
+
Token.Identifiers.MethodName("GetType"),
430
+
Token.Punctuation.OpenParen,
431
+
Token.Punctuation.CloseParen,
432
+
Token.Operators.Relational.Equals,
433
+
Token.Keywords.TypeOf,
434
+
Token.Punctuation.OpenParen,
435
+
Token.Type("DataNotFoundException"),
436
+
Token.Punctuation.CloseParen,
437
+
Token.Punctuation.CloseParen,
438
+
Token.Comment.SingleLine.Start,
439
+
Token.Comment.SingleLine.Text("Only catch exceptions that are distinctly DataNotFoundException"),
0 commit comments