Skip to content

Commit 762cd03

Browse files
add a test for GetAllUsesOfAllSymbolsInFile for single case discriminated union
1 parent 3f97dc0 commit 762cd03

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

tests/service/EditorTests.fs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -462,4 +462,21 @@ let _ = sprintf "ABCDE"
462462
typeCheckResults.GetFormatSpecifierLocations()
463463
|> Array.map (fun range -> range.StartLine, range.StartColumn, range.EndLine, range.EndColumn)
464464
|> shouldEqual [||]
465+
466+
[<Test>]
467+
let ``Single case discreminated union type definition`` () =
468+
let input =
469+
"""
470+
type DU = Case1
471+
"""
472+
473+
let file = "/home/user/Test.fsx"
474+
let untyped, typeCheckResults = parseAndTypeCheckFileInProject(file, input)
475+
typeCheckResults.GetAllUsesOfAllSymbolsInFile()
476+
|> Async.RunSynchronously
477+
|> Array.map (fun su ->
478+
let r = su.RangeAlternate
479+
r.StartLine, r.StartColumn, r.EndLine, r.EndColumn)
480+
|> shouldEqual [|(2, 10, 2, 15); (2, 5, 2, 7); (1, 0, 1, 0)|]
481+
465482

0 commit comments

Comments
 (0)