forked from dotnet/fsharp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBreakpointLocationTests.fs
More file actions
57 lines (47 loc) · 1.33 KB
/
Copy pathBreakpointLocationTests.fs
File metadata and controls
57 lines (47 loc) · 1.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
module FSharp.Compiler.Service.Tests.BreakpointLocationTests
open FSharp.Compiler.Text
open FSharp.Compiler.Text.Range
open FSharp.Test.Assert
open Xunit
let assertBreakpointRange ((startLine, startCol), (endLine, endCol)) markedSource =
let context, parseResults = Checker.getParseResultsWithContext markedSource
let breakpointRange = parseResults.ValidateBreakpointLocation(context.CaretPos).Value
let startPos = Position.mkPos startLine startCol
let endPod = Position.mkPos endLine endCol
let expectedRange = mkFileIndexRange breakpointRange.FileIndex startPos endPod
breakpointRange |> shouldEqual expectedRange
[<Fact>]
let ``Let - Function - Body 01`` () =
assertBreakpointRange ((3, 4), (3, 5)) """
let f () =
1{caret}
"""
[<Fact>]
let ``Seq 01`` () =
assertBreakpointRange ((3, 4), (3, 5)) """
do
1{caret}
2
"""
[<Fact>]
let ``Seq 02`` () =
assertBreakpointRange ((4, 4), (4, 5)) """
do
1
2{caret}
"""
[<Fact>]
let ``Lambda 01`` () =
assertBreakpointRange ((2, 27), (2, 35)) """
[""] |> List.map (fun s -> s.Lenght{caret})
"""
[<Fact>]
let ``Dot lambda 01`` () =
assertBreakpointRange ((2, 17), (2, 25)) """
[""] |> List.map _.Lenght{caret}
"""
[<Fact>]
let ``Dot lambda 02`` () =
assertBreakpointRange ((2, 17), (2, 36)) """
[""] |> List.map _.ToString().Length{caret}
"""