Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep file paths from current dir in tests. #206

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion analysis/src/Uri2.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,11 @@ end = struct

let toPath {path} = path

let toString {uri} = if !stripPath then Filename.basename uri else uri
let toString {uri} =
if !stripPath then
let n = Str.search_forward (Str.regexp "test") uri 0 in
String.sub uri n (String.length uri - n)
else uri
end

include Uri
32 changes: 16 additions & 16 deletions analysis/tests/src/expected/Completion.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -459,82 +459,82 @@ DocumentSymbol tests/src/Completion.res
{
"name": "MyList",
"kind": 2,
"location": {"uri": "Completion.res", "range": {"start": {"line": 0, "character": 7}, "end": {"line": 0, "character": 25}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 0, "character": 7}, "end": {"line": 0, "character": 25}}}
},
{
"name": "Dep",
"kind": 2,
"location": {"uri": "Completion.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 11, "character": 1}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 11, "character": 1}}}
},
{
"name": "customDouble",
"kind": 12,
"location": {"uri": "Completion.res", "range": {"start": {"line": 7, "character": 2}, "end": {"line": 8, "character": 30}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 7, "character": 2}, "end": {"line": 8, "character": 30}}}
},
{
"name": "Lib",
"kind": 2,
"location": {"uri": "Completion.res", "range": {"start": {"line": 15, "character": 7}, "end": {"line": 18, "character": 1}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 15, "character": 7}, "end": {"line": 18, "character": 1}}}
},
{
"name": "foo",
"kind": 12,
"location": {"uri": "Completion.res", "range": {"start": {"line": 16, "character": 6}, "end": {"line": 16, "character": 9}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 16, "character": 6}, "end": {"line": 16, "character": 9}}}
},
{
"name": "next",
"kind": 12,
"location": {"uri": "Completion.res", "range": {"start": {"line": 17, "character": 6}, "end": {"line": 17, "character": 10}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 17, "character": 6}, "end": {"line": 17, "character": 10}}}
},
{
"name": "op",
"kind": 13,
"location": {"uri": "Completion.res", "range": {"start": {"line": 26, "character": 4}, "end": {"line": 26, "character": 6}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 26, "character": 4}, "end": {"line": 26, "character": 6}}}
},
{
"name": "ForAuto",
"kind": 2,
"location": {"uri": "Completion.res", "range": {"start": {"line": 30, "character": 7}, "end": {"line": 34, "character": 1}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 30, "character": 7}, "end": {"line": 34, "character": 1}}}
},
{
"name": "t",
"kind": 26,
"location": {"uri": "Completion.res", "range": {"start": {"line": 31, "character": 2}, "end": {"line": 31, "character": 14}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 31, "character": 2}, "end": {"line": 31, "character": 14}}}
},
{
"name": "abc",
"kind": 12,
"location": {"uri": "Completion.res", "range": {"start": {"line": 32, "character": 6}, "end": {"line": 32, "character": 9}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 32, "character": 6}, "end": {"line": 32, "character": 9}}}
},
{
"name": "abd",
"kind": 12,
"location": {"uri": "Completion.res", "range": {"start": {"line": 33, "character": 6}, "end": {"line": 33, "character": 9}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 33, "character": 6}, "end": {"line": 33, "character": 9}}}
},
{
"name": "fa",
"kind": 13,
"location": {"uri": "Completion.res", "range": {"start": {"line": 36, "character": 4}, "end": {"line": 36, "character": 6}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 36, "character": 4}, "end": {"line": 36, "character": 6}}}
},
{
"name": "O",
"kind": 2,
"location": {"uri": "Completion.res", "range": {"start": {"line": 41, "character": 7}, "end": {"line": 47, "character": 1}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 41, "character": 7}, "end": {"line": 47, "character": 1}}}
},
{
"name": "Comp",
"kind": 2,
"location": {"uri": "Completion.res", "range": {"start": {"line": 42, "character": 9}, "end": {"line": 46, "character": 3}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 42, "character": 9}, "end": {"line": 46, "character": 3}}}
},
{
"name": "make",
"kind": 12,
"location": {"uri": "Completion.res", "range": {"start": {"line": 44, "character": 8}, "end": {"line": 44, "character": 12}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 44, "character": 8}, "end": {"line": 44, "character": 12}}}
},
{
"name": "zzz",
"kind": 13,
"location": {"uri": "Completion.res", "range": {"start": {"line": 49, "character": 4}, "end": {"line": 49, "character": 7}}}
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 49, "character": 4}, "end": {"line": 49, "character": 7}}}
}
]

Expand Down
4 changes: 2 additions & 2 deletions analysis/tests/src/expected/Definition.res.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Definition tests/src/Definition.res 2:8
{"uri": "Definition.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 6}}}
{"uri": "tests/src/Definition.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 6}}}

Definition tests/src/Definition.res 10:23
{"uri": "Definition.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 6, "character": 13}}}
{"uri": "tests/src/Definition.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 6, "character": 13}}}

Hover tests/src/Definition.res 14:14
{"contents": "```rescript\n('a => 'b, list<'a>) => list<'b>\n```\n\n [List.map f [a1; ...; an]] applies function [f] to [a1, ..., an],\n and builds the list [[f a1; ...; f an]]\n with the results returned by [f]. Not tail-recursive. "}
Expand Down
2 changes: 1 addition & 1 deletion analysis/tests/src/expected/Hover.res.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Hover tests/src/Hover.res 52:7
{"contents": "```rescript\nmodule Logger = {\n let log: string => unit\n}\n```"}

Definition tests/src/Hover.res 58:14
{"uri": "Hover.res", "range": {"start": {"line": 47, "character": 12}, "end": {"line": 47, "character": 18}}}
{"uri": "tests/src/Hover.res", "range": {"start": {"line": 47, "character": 12}, "end": {"line": 47, "character": 18}}}

Hover tests/src/Hover.res 62:9
{"contents": "```rescript\nmodule IdDefinedTwice = {\n let y: int\n let _x: int\n}\n```"}
Expand Down
2 changes: 1 addition & 1 deletion analysis/tests/src/expected/Jsx.res.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Definition tests/src/Jsx.res 5:9
{"uri": "Jsx.res", "range": {"start": {"line": 2, "character": 6}, "end": {"line": 2, "character": 10}}}
{"uri": "tests/src/Jsx.res", "range": {"start": {"line": 2, "character": 6}, "end": {"line": 2, "character": 10}}}

Complete tests/src/Jsx.res 7:2
[{
Expand Down
10 changes: 5 additions & 5 deletions analysis/tests/src/expected/Patterns.res.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
Definition tests/src/Patterns.res 20:10
{"uri": "Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}}
{"uri": "tests/src/Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}}

Definition tests/src/Patterns.res 25:11
{"uri": "Patterns.res", "range": {"start": {"line": 9, "character": 7}, "end": {"line": 9, "character": 11}}}
{"uri": "tests/src/Patterns.res", "range": {"start": {"line": 9, "character": 7}, "end": {"line": 9, "character": 11}}}

Definition tests/src/Patterns.res 28:11
{"uri": "Patterns.res", "range": {"start": {"line": 11, "character": 7}, "end": {"line": 11, "character": 8}}}
{"uri": "tests/src/Patterns.res", "range": {"start": {"line": 11, "character": 7}, "end": {"line": 11, "character": 8}}}

Definition tests/src/Patterns.res 31:11
{"uri": "Patterns.res", "range": {"start": {"line": 15, "character": 9}, "end": {"line": 15, "character": 11}}}
{"uri": "tests/src/Patterns.res", "range": {"start": {"line": 15, "character": 9}, "end": {"line": 15, "character": 11}}}

Definition tests/src/Patterns.res 34:11
{"uri": "Patterns.res", "range": {"start": {"line": 17, "character": 11}, "end": {"line": 17, "character": 16}}}
{"uri": "tests/src/Patterns.res", "range": {"start": {"line": 17, "character": 11}, "end": {"line": 17, "character": 16}}}

8 changes: 4 additions & 4 deletions analysis/tests/src/expected/References.res.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
References tests/src/References.res 0:4
[
{"uri": "Cross.res", "range": {"start": {"line": 0, "character": 26}, "end": {"line": 0, "character": 27}}},
{"uri": "References.res", "range": {"start": {"line": 7, "character": 8}, "end": {"line": 7, "character": 9}}},
{"uri": "References.res", "range": {"start": {"line": 3, "character": 8}, "end": {"line": 3, "character": 9}}},
{"uri": "References.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}}
{"uri": "tests/src/Cross.res", "range": {"start": {"line": 0, "character": 26}, "end": {"line": 0, "character": 27}}},
{"uri": "tests/src/References.res", "range": {"start": {"line": 7, "character": 8}, "end": {"line": 7, "character": 9}}},
{"uri": "tests/src/References.res", "range": {"start": {"line": 3, "character": 8}, "end": {"line": 3, "character": 9}}},
{"uri": "tests/src/References.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}}
]