| 21 | } |
| 22 | |
| 23 | func TestLSPRelPath(t *testing.T) { |
| 24 | if got := relPath("/ws/proj", "file:///ws/proj/cli/cli.go"); got != "cli/cli.go" { |
| 25 | t.Fatalf("in-root path = %q, want workspace-relative", got) |
| 26 | } |
| 27 | if got := relPath("/ws/proj", "file:///usr/lib/go/src/fmt/print.go"); got != "/usr/lib/go/src/fmt/print.go" { |
| 28 | t.Fatalf("out-of-root path = %q, want absolute", got) |
| 29 | } |
| 30 | if got := relPath("", "file:///a/b.go"); got != "/a/b.go" { |
| 31 | t.Fatalf("empty root = %q, want absolute", got) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | func TestLSPFormatLocationsBoundsAndConverts(t *testing.T) { |
| 36 | locs := []lsp.Location{ |