1
1
#if INTERACTIVE
2
2
#r " ../../artifacts/bin/fcs/net461/FSharp.Compiler.Service.dll" // note, build FSharp.Compiler.Service.Tests.fsproj to generate this, this DLL has a public API so can be used from F# Interactive
3
- #r " ../../artifacts/bin/fcs/net461/nunit.framework.dll"
4
- #load " FsUnit.fs"
5
- #load " Common.fs"
3
+ #r " ../../artifacts/bin/fcs/net461/xunit.dll"
6
4
#else
7
5
module Tests.Service.StructureTests
8
6
#endif
9
7
10
8
open System.IO
11
- open NUnit.Framework
12
- open FSharp.Compiler .EditorServices
9
+ open Xunit
13
10
open FSharp.Compiler .EditorServices .Structure
14
11
open FSharp.Compiler .Service .Tests .Common
15
12
open FSharp.Compiler .Text
@@ -55,10 +52,10 @@ let (=>) (source: string) (expectedRanges: (Range * Range) list) =
55
52
printfn " AST:\n %+A " ast
56
53
reraise()
57
54
58
- [<Test >]
55
+ [<Fact >]
59
56
let ``empty file`` () = " " => []
60
57
61
- [<Test >]
58
+ [<Fact >]
62
59
let ``nested module`` () =
63
60
"""
64
61
module MyModule =
@@ -71,7 +68,7 @@ module Module =
71
68
=> [ ( 2 , 0 , 3 , 6 ), ( 2 , 15 , 3 , 6 )
72
69
( 5 , 0 , 7 , 6 ), ( 6 , 13 , 7 , 6 ) ]
73
70
74
- [<Test >]
71
+ [<Fact >]
75
72
let ``module with multiline function`` () =
76
73
"""
77
74
module MyModule =
@@ -82,7 +79,7 @@ module MyModule =
82
79
( 3 , 4 , 4 , 13 ), ( 3 , 13 , 4 , 13 )
83
80
( 3 , 8 , 4 , 13 ), ( 3 , 13 , 4 , 13 ) ]
84
81
85
- [<Test >]
82
+ [<Fact >]
86
83
let ``DU`` () =
87
84
"""
88
85
type Color =
@@ -93,7 +90,7 @@ type Color =
93
90
=> [ ( 2 , 5 , 5 , 10 ), ( 2 , 11 , 5 , 10 )
94
91
( 3 , 4 , 5 , 10 ), ( 3 , 4 , 5 , 10 ) ]
95
92
96
- [<Test >]
93
+ [<Fact >]
97
94
let ``DU with interface`` () =
98
95
"""
99
96
type Color =
@@ -111,7 +108,7 @@ type Color =
111
108
( 8 , 8 , 9 , 55 ), ( 8 , 27 , 9 , 55 )
112
109
( 8 , 15 , 9 , 55 ), ( 8 , 27 , 9 , 55 ) ]
113
110
114
- [<Test >]
111
+ [<Fact >]
115
112
let ``record with interface`` () =
116
113
"""
117
114
type Color =
@@ -133,7 +130,7 @@ type Color =
133
130
( 9 , 8 , 10 , 55 ), ( 9 , 27 , 10 , 55 )
134
131
( 9 , 15 , 10 , 55 ), ( 9 , 27 , 10 , 55 ) ]
135
132
136
- [<Test >]
133
+ [<Fact >]
137
134
let ``type with a do block`` () =
138
135
"""
139
136
type Color() = // 2
@@ -148,7 +145,7 @@ type Color() = // 2
148
145
( 3 , 8 , 4 , 10 ), ( 3 , 13 , 4 , 10 )
149
146
( 6 , 4 , 8 , 10 ), ( 6 , 6 , 8 , 10 ) ]
150
147
151
- [<Test >]
148
+ [<Fact >]
152
149
let ``complex outlining test`` () =
153
150
"""
154
151
module MyModule = // 2
@@ -194,7 +191,7 @@ module MyModule = // 2
194
191
( 26 , 23 , 27 , 63 ), ( 26 , 35 , 27 , 63 ) ]
195
192
196
193
197
- [<Test >]
194
+ [<Fact >]
198
195
let ``open statements`` () =
199
196
"""
200
197
open M
@@ -231,7 +228,7 @@ open H
231
228
( 17 , 8 , 18 , 14 ), ( 17 , 8 , 18 , 14 )
232
229
( 21 , 0 , 26 , 6 ), ( 21 , 0 , 26 , 6 ) ]
233
230
234
- [<Test >]
231
+ [<Fact >]
235
232
let ``hash directives`` () =
236
233
"""
237
234
#r @"a"
@@ -260,7 +257,7 @@ let x = 1
260
257
=> [ ( 2 , 3 , 8 , 6 ), ( 2 , 3 , 8 , 6 )
261
258
( 11 , 3 , 23 , 6 ), ( 11 , 3 , 23 , 6 ) ]
262
259
263
- [<Test >]
260
+ [<Fact >]
264
261
let ``nested let bindings`` () =
265
262
"""
266
263
let f x = // 2
@@ -275,7 +272,7 @@ let f x = // 2
275
272
( 3 , 8 , 6 , 10 ), ( 3 , 11 , 6 , 10 )
276
273
( 4 , 12 , 5 , 14 ), ( 4 , 13 , 5 , 14 ) ]
277
274
278
- [<Test >]
275
+ [<Fact >]
279
276
let ``match`` () =
280
277
"""
281
278
match None with // 2
@@ -293,7 +290,7 @@ match None with // 2
293
290
( 6 , 4 , 10 , 10 ), ( 6 , 19 , 10 , 10 )
294
291
( 9 , 8 , 10 , 10 ), ( 8 , 10 , 10 , 10 ) ]
295
292
296
- [<Test >]
293
+ [<Fact >]
297
294
let ``matchbang`` () =
298
295
"""
299
296
async { // 2
@@ -314,7 +311,7 @@ async { // 2
314
311
( 7 , 8 , 11 , 14 ), ( 7 , 23 , 11 , 14 )
315
312
( 10 , 12 , 11 , 14 ), ( 9 , 14 , 11 , 14 ) ]
316
313
317
- [<Test >]
314
+ [<Fact >]
318
315
let ``computation expressions`` () =
319
316
"""
320
317
seq { // 2
@@ -330,7 +327,7 @@ seq { // 2
330
327
( 6 , 4 , 7 , 18 ), ( 6 , 4 , 7 , 18 )
331
328
( 6 , 11 , 7 , 18 ), ( 6 , 16 , 7 , 17 ) ]
332
329
333
- [<Test >]
330
+ [<Fact >]
334
331
let ``list`` () =
335
332
"""
336
333
let _ =
@@ -341,7 +338,7 @@ let _ =
341
338
( 2 , 4 , 4 , 9 ), ( 2 , 5 , 4 , 9 )
342
339
( 3 , 4 , 4 , 9 ), ( 3 , 5 , 4 , 8 ) ]
343
340
344
- [<Test >]
341
+ [<Fact >]
345
342
let ``object expressions`` () =
346
343
"""
347
344
let _ =
@@ -352,7 +349,7 @@ let _ =
352
349
( 2 , 4 , 4 , 34 ), ( 2 , 5 , 4 , 34 )
353
350
( 3 , 4 , 4 , 34 ), ( 3 , 28 , 4 , 34 ) ]
354
351
355
- [<Test >]
352
+ [<Fact >]
356
353
let ``try - with ``() =
357
354
"""
358
355
try // 2
@@ -370,7 +367,7 @@ with _ -> // 5
370
367
( 6 , 4 , 8 , 6 ), ( 5 , 6 , 8 , 6 )
371
368
( 6 , 8 , 7 , 10 ), ( 6 , 11 , 7 , 10 ) ]
372
369
373
- [<Test >]
370
+ [<Fact >]
374
371
let ``try - finally`` () =
375
372
"""
376
373
try // 2
@@ -386,7 +383,7 @@ finally // 5
386
383
( 5 , 0 , 8 , 6 ), ( 5 , 7 , 8 , 6 )
387
384
( 6 , 8 , 7 , 10 ), ( 6 , 11 , 7 , 10 ) ]
388
385
389
- [<Test >]
386
+ [<Fact >]
390
387
let ``if - then - else`` () =
391
388
"""
392
389
if true then
403
400
( 3 , 8 , 4 , 10 ), ( 3 , 11 , 4 , 10 )
404
401
( 7 , 8 , 8 , 10 ), ( 7 , 11 , 8 , 10 ) ]
405
402
406
- [<Test >]
403
+ [<Fact >]
407
404
let ``code quotation`` () =
408
405
"""
409
406
<@
@@ -412,7 +409,7 @@ let ``code quotation``() =
412
409
"""
413
410
=> [ ( 2 , 0 , 4 , 10 ), ( 2 , 2 , 4 , 8 ) ]
414
411
415
- [<Test >]
412
+ [<Fact >]
416
413
let ``raw code quotation`` () =
417
414
"""
418
415
<@@
@@ -421,7 +418,7 @@ let ``raw code quotation``() =
421
418
"""
422
419
=> [ ( 2 , 0 , 4 , 11 ), ( 2 , 3 , 4 , 8 ) ]
423
420
424
- [<Test >]
421
+ [<Fact >]
425
422
let ``match lambda aka function`` () =
426
423
"""
427
424
function
@@ -431,7 +428,7 @@ function
431
428
=> [ ( 2 , 0 , 4 , 10 ), ( 2 , 8 , 4 , 10 )
432
429
( 3 , 8 , 4 , 10 ), ( 3 , 3 , 4 , 10 ) ]
433
430
434
- [<Test >]
431
+ [<Fact >]
435
432
let ``match guarded clause`` () =
436
433
"""
437
434
let matchwith num =
@@ -444,7 +441,7 @@ let matchwith num =
444
441
( 3 , 4 , 5 , 13 ), ( 3 , 18 , 5 , 13 )
445
442
( 4 , 11 , 5 , 13 ), ( 4 , 7 , 5 , 13 ) ]
446
443
447
- [<Test >]
444
+ [<Fact >]
448
445
let ``for loop`` () =
449
446
"""
450
447
for x = 100 downto 10 do
@@ -453,7 +450,7 @@ for x = 100 downto 10 do
453
450
"""
454
451
=> [ ( 2 , 0 , 4 , 6 ), ( 2 , 0 , 4 , 6 ) ]
455
452
456
- [<Test >]
453
+ [<Fact >]
457
454
let ``for each`` () =
458
455
"""
459
456
for x in 0 .. 100 ->
@@ -463,7 +460,7 @@ for x in 0 .. 100 ->
463
460
=> [ ( 2 , 0 , 4 , 14 ), ( 2 , 0 , 4 , 14 )
464
461
( 2 , 18 , 4 , 14 ), ( 2 , 18 , 4 , 14 ) ]
465
462
466
- [<Test >]
463
+ [<Fact >]
467
464
let ``tuple`` () =
468
465
"""
469
466
( 20340
@@ -472,7 +469,7 @@ let ``tuple``() =
472
469
"""
473
470
=> [ ( 2 , 2 , 4 , 8 ), ( 2 , 2 , 4 , 8 ) ]
474
471
475
- [<Test >]
472
+ [<Fact >]
476
473
let ``do ! ``() =
477
474
"""
478
475
do!
481
478
"""
482
479
=> [ ( 2 , 0 , 4 , 18 ), ( 2 , 3 , 4 , 18 ) ]
483
480
484
- [<Test >]
481
+ [<Fact >]
485
482
let ``cexpr yield yield ! ``() =
486
483
"""
487
484
cexpr{
@@ -498,7 +495,7 @@ cexpr{
498
495
( 4 , 8 , 8 , 17 ), ( 4 , 14 , 8 , 16 )
499
496
( 5 , 20 , 7 , 26 ), ( 5 , 20 , 7 , 26 ) ]
500
497
501
- [<Test >]
498
+ [<Fact >]
502
499
let ``XML doc comments`` () =
503
500
"""
504
501
/// Line 1
@@ -523,7 +520,7 @@ module M =
523
520
( 12 , 4 , 13 , 15 ), ( 13 , 11 , 13 , 15 )
524
521
( 12 , 4 , 13 , 15 ), ( 13 , 11 , 13 , 15 ) ]
525
522
526
- [<Test >]
523
+ [<Fact >]
527
524
let ``regular comments`` () =
528
525
"""
529
526
// Line 1
@@ -545,7 +542,7 @@ module M =
545
542
( 7 , 9 , 11 , 19 ), ( 7 , 11 , 11 , 19 )
546
543
( 8 , 8 , 10 , 17 ), ( 8 , 8 , 10 , 17 ) ]
547
544
548
- [<Test >]
545
+ [<Fact >]
549
546
let ``XML doc and regular comments in one block`` () =
550
547
"""
551
548
// Line 1
@@ -562,7 +559,7 @@ let ``XML doc and regular comments in one block``() =
562
559
( 4 , 0 , 5 , 10 ), ( 4 , 0 , 5 , 10 )
563
560
( 7 , 0 , 10 , 10 ), ( 7 , 0 , 10 , 10 ) ]
564
561
565
- [<Test >]
562
+ [<Fact >]
566
563
let ``constructor call`` () =
567
564
"""
568
565
module M =
@@ -577,7 +574,7 @@ module M =
577
574
( 4 , 8 , 6 , 14 ), ( 4 , 25 , 6 , 14 )
578
575
( 5 , 12 , 6 , 13 ), ( 5 , 12 , 6 , 13 ) ]
579
576
580
- [<Test >]
577
+ [<Fact >]
581
578
let ``Top level module`` () =
582
579
"""
583
580
module TopLevelModule
@@ -588,7 +585,7 @@ module Nested =
588
585
=> [ ( 2 , 7 , 5 , 15 ), ( 2 , 21 , 5 , 15 )
589
586
( 4 , 0 , 5 , 15 ), ( 4 , 13 , 5 , 15 ) ]
590
587
591
- [<Test >]
588
+ [<Fact >]
592
589
let ``Top level namespace`` () =
593
590
"""
594
591
namespace TopLevelNamespace.Another
@@ -598,7 +595,7 @@ module Nested =
598
595
"""
599
596
=> [ ( 4 , 0 , 5 , 15 ), ( 4 , 13 , 5 , 15 ) ]
600
597
601
- [<Test >]
598
+ [<Fact >]
602
599
let ``Multiple namespaces`` () =
603
600
"""
604
601
namespace TopLevelNamespace.Another
@@ -614,7 +611,7 @@ module NestedModule =
614
611
=> [ ( 4 , 0 , 5 , 15 ), ( 4 , 13 , 5 , 15 )
615
612
( 9 , 0 , 10 , 15 ), ( 9 , 19 , 10 , 15 ) ]
616
613
617
- [<Test >]
614
+ [<Fact >]
618
615
let ``Member val`` () =
619
616
"""
620
617
type T() =
@@ -638,7 +635,7 @@ type T() =
638
635
( 10 , 4 , 11 , 10 ), ( 10 , 4 , 11 , 10 )
639
636
( 13 , 4 , 15 , 10 ), ( 13 , 4 , 15 , 10 ) ]
640
637
641
- [<Test >]
638
+ [<Fact >]
642
639
let ``Secondary constructors`` () =
643
640
"""
644
641
type T() =
@@ -661,7 +658,7 @@ type T() =
661
658
( 9 , 4 , 11 , 12 ), ( 10 , 10 , 11 , 12 ) ]
662
659
663
660
664
- [<Test >]
661
+ [<Fact >]
665
662
let ``Abstract members`` () =
666
663
"""
667
664
type T() =
0 commit comments