Skip to content

Commit efbc6f3

Browse files
committed
tests: Add a test illustrating the issue
1 parent d78b9d5 commit efbc6f3

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
$ cat >main.ml <<EOF
2+
> module Bar : sig
3+
> module Foo : sig
4+
> val v : int
5+
> end
6+
> end = struct
7+
> module Foo = struct
8+
> let v = 42
9+
> end
10+
> end
11+
> module Foo = Bar.Foo
12+
> let _ = Foo.v
13+
> EOF
14+
15+
$ cat>other.ml <<EOF
16+
> module Foo = Main.Bar.Foo
17+
> let _ = Foo.v
18+
> EOF
19+
20+
$ $OCAMLC -c -bin-annot main.ml other.ml
21+
22+
$ $MERLIN single locate -look-for ml -position 11:10 \
23+
> -filename ./main.ml < ./main.ml | jq '.value'
24+
{
25+
"file": "$TESTCASE_ROOT/main.ml",
26+
"pos": {
27+
"line": 6,
28+
"col": 2
29+
}
30+
}
31+
32+
FIXME: it would be more useful to traverse the alias and jump to 2:2
33+
$ $MERLIN single locate -look-for mli -position 11:10 \
34+
> -filename ./main.ml < ./main.ml | jq '.value'
35+
{
36+
"file": "$TESTCASE_ROOT/main.ml",
37+
"pos": {
38+
"line": 10,
39+
"col": 0
40+
}
41+
}
42+
$ $MERLIN single locate -look-for ml -position 2:10 \
43+
> -filename ./other.ml < ./other.ml | jq '.value'
44+
{
45+
"file": "$TESTCASE_ROOT/main.ml",
46+
"pos": {
47+
"line": 6,
48+
"col": 2
49+
}
50+
}
51+
52+
FIXME: it would be more useful to traverse the alias and jump to main 2:2
53+
$ $MERLIN single locate -look-for mli -position 2:10 \
54+
> -filename ./other.ml < ./other.ml | jq '.value'
55+
{
56+
"file": "$TESTCASE_ROOT/other.ml",
57+
"pos": {
58+
"line": 1,
59+
"col": 0
60+
}
61+
}

0 commit comments

Comments
 (0)