Skip to content

Commit aecbabf

Browse files
committed
Keep file paths from current dir in tests.
Fixes #202
1 parent 6a643be commit aecbabf

File tree

7 files changed

+34
-30
lines changed

7 files changed

+34
-30
lines changed

analysis/src/Uri2.ml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,11 @@ end = struct
3636

3737
let toPath {path} = path
3838

39-
let toString {uri} = if !stripPath then Filename.basename uri else uri
39+
let toString {uri} =
40+
if !stripPath then
41+
let n = Str.search_forward (Str.regexp "test") uri 0 in
42+
String.sub uri n (String.length uri - n)
43+
else uri
4044
end
4145

4246
include Uri

analysis/tests/src/expected/Completion.res.txt

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -459,82 +459,82 @@ DocumentSymbol tests/src/Completion.res
459459
{
460460
"name": "MyList",
461461
"kind": 2,
462-
"location": {"uri": "Completion.res", "range": {"start": {"line": 0, "character": 7}, "end": {"line": 0, "character": 25}}}
462+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 0, "character": 7}, "end": {"line": 0, "character": 25}}}
463463
},
464464
{
465465
"name": "Dep",
466466
"kind": 2,
467-
"location": {"uri": "Completion.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 11, "character": 1}}}
467+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 6, "character": 7}, "end": {"line": 11, "character": 1}}}
468468
},
469469
{
470470
"name": "customDouble",
471471
"kind": 12,
472-
"location": {"uri": "Completion.res", "range": {"start": {"line": 7, "character": 2}, "end": {"line": 8, "character": 30}}}
472+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 7, "character": 2}, "end": {"line": 8, "character": 30}}}
473473
},
474474
{
475475
"name": "Lib",
476476
"kind": 2,
477-
"location": {"uri": "Completion.res", "range": {"start": {"line": 15, "character": 7}, "end": {"line": 18, "character": 1}}}
477+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 15, "character": 7}, "end": {"line": 18, "character": 1}}}
478478
},
479479
{
480480
"name": "foo",
481481
"kind": 12,
482-
"location": {"uri": "Completion.res", "range": {"start": {"line": 16, "character": 6}, "end": {"line": 16, "character": 9}}}
482+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 16, "character": 6}, "end": {"line": 16, "character": 9}}}
483483
},
484484
{
485485
"name": "next",
486486
"kind": 12,
487-
"location": {"uri": "Completion.res", "range": {"start": {"line": 17, "character": 6}, "end": {"line": 17, "character": 10}}}
487+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 17, "character": 6}, "end": {"line": 17, "character": 10}}}
488488
},
489489
{
490490
"name": "op",
491491
"kind": 13,
492-
"location": {"uri": "Completion.res", "range": {"start": {"line": 26, "character": 4}, "end": {"line": 26, "character": 6}}}
492+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 26, "character": 4}, "end": {"line": 26, "character": 6}}}
493493
},
494494
{
495495
"name": "ForAuto",
496496
"kind": 2,
497-
"location": {"uri": "Completion.res", "range": {"start": {"line": 30, "character": 7}, "end": {"line": 34, "character": 1}}}
497+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 30, "character": 7}, "end": {"line": 34, "character": 1}}}
498498
},
499499
{
500500
"name": "t",
501501
"kind": 26,
502-
"location": {"uri": "Completion.res", "range": {"start": {"line": 31, "character": 2}, "end": {"line": 31, "character": 14}}}
502+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 31, "character": 2}, "end": {"line": 31, "character": 14}}}
503503
},
504504
{
505505
"name": "abc",
506506
"kind": 12,
507-
"location": {"uri": "Completion.res", "range": {"start": {"line": 32, "character": 6}, "end": {"line": 32, "character": 9}}}
507+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 32, "character": 6}, "end": {"line": 32, "character": 9}}}
508508
},
509509
{
510510
"name": "abd",
511511
"kind": 12,
512-
"location": {"uri": "Completion.res", "range": {"start": {"line": 33, "character": 6}, "end": {"line": 33, "character": 9}}}
512+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 33, "character": 6}, "end": {"line": 33, "character": 9}}}
513513
},
514514
{
515515
"name": "fa",
516516
"kind": 13,
517-
"location": {"uri": "Completion.res", "range": {"start": {"line": 36, "character": 4}, "end": {"line": 36, "character": 6}}}
517+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 36, "character": 4}, "end": {"line": 36, "character": 6}}}
518518
},
519519
{
520520
"name": "O",
521521
"kind": 2,
522-
"location": {"uri": "Completion.res", "range": {"start": {"line": 41, "character": 7}, "end": {"line": 47, "character": 1}}}
522+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 41, "character": 7}, "end": {"line": 47, "character": 1}}}
523523
},
524524
{
525525
"name": "Comp",
526526
"kind": 2,
527-
"location": {"uri": "Completion.res", "range": {"start": {"line": 42, "character": 9}, "end": {"line": 46, "character": 3}}}
527+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 42, "character": 9}, "end": {"line": 46, "character": 3}}}
528528
},
529529
{
530530
"name": "make",
531531
"kind": 12,
532-
"location": {"uri": "Completion.res", "range": {"start": {"line": 44, "character": 8}, "end": {"line": 44, "character": 12}}}
532+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 44, "character": 8}, "end": {"line": 44, "character": 12}}}
533533
},
534534
{
535535
"name": "zzz",
536536
"kind": 13,
537-
"location": {"uri": "Completion.res", "range": {"start": {"line": 49, "character": 4}, "end": {"line": 49, "character": 7}}}
537+
"location": {"uri": "tests/src/Completion.res", "range": {"start": {"line": 49, "character": 4}, "end": {"line": 49, "character": 7}}}
538538
}
539539
]
540540

analysis/tests/src/expected/Definition.res.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
Definition tests/src/Definition.res 2:8
2-
{"uri": "Definition.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 6}}}
2+
{"uri": "tests/src/Definition.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 6}}}
33

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

77
Hover tests/src/Definition.res 14:14
88
{"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. "}

analysis/tests/src/expected/Hover.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Hover tests/src/Hover.res 52:7
3535
{"contents": "```rescript\nmodule Logger = {\n let log: string => unit\n}\n```"}
3636

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

4040
Hover tests/src/Hover.res 62:9
4141
{"contents": "```rescript\nmodule IdDefinedTwice = {\n let y: int\n let _x: int\n}\n```"}

analysis/tests/src/expected/Jsx.res.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Definition tests/src/Jsx.res 5:9
2-
{"uri": "Jsx.res", "range": {"start": {"line": 2, "character": 6}, "end": {"line": 2, "character": 10}}}
2+
{"uri": "tests/src/Jsx.res", "range": {"start": {"line": 2, "character": 6}, "end": {"line": 2, "character": 10}}}
33

44
Complete tests/src/Jsx.res 7:2
55
[{
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
Definition tests/src/Patterns.res 20:10
2-
{"uri": "Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}}
2+
{"uri": "tests/src/Patterns.res", "range": {"start": {"line": 3, "character": 7}, "end": {"line": 3, "character": 10}}}
33

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

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

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

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
References tests/src/References.res 0:4
22
[
3-
{"uri": "Cross.res", "range": {"start": {"line": 0, "character": 26}, "end": {"line": 0, "character": 27}}},
4-
{"uri": "References.res", "range": {"start": {"line": 7, "character": 8}, "end": {"line": 7, "character": 9}}},
5-
{"uri": "References.res", "range": {"start": {"line": 3, "character": 8}, "end": {"line": 3, "character": 9}}},
6-
{"uri": "References.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}}
3+
{"uri": "tests/src/Cross.res", "range": {"start": {"line": 0, "character": 26}, "end": {"line": 0, "character": 27}}},
4+
{"uri": "tests/src/References.res", "range": {"start": {"line": 7, "character": 8}, "end": {"line": 7, "character": 9}}},
5+
{"uri": "tests/src/References.res", "range": {"start": {"line": 3, "character": 8}, "end": {"line": 3, "character": 9}}},
6+
{"uri": "tests/src/References.res", "range": {"start": {"line": 0, "character": 4}, "end": {"line": 0, "character": 5}}}
77
]
88

0 commit comments

Comments
 (0)