Skip to content

Commit 819e419

Browse files
committed
document: add a test showing retrieval of docstrings not present on AST
1 parent cb02ab6 commit 819e419

File tree

4 files changed

+33
-0
lines changed

4 files changed

+33
-0
lines changed
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
A test showing that we manage to get docstrings even when they are not kept as
2+
attributes on the AST.
3+
4+
$ cat >test.ml <<EOF
5+
> let foo x y = (** incorrect doc for foo *)
6+
> x + y
7+
>
8+
> let bar = foo
9+
> EOF
10+
11+
$ $MERLIN single document -position 4:13 -filename test.ml < test.ml
12+
{
13+
"class": "return",
14+
"value": "incorrect doc for foo",
15+
"notifications": []
16+
}
17+
18+
And that it also works outside of the current buffer:
19+
20+
$ $OCAMLC -c -bin-annot -w +50 test.ml
21+
File "test.ml", line 1, characters 14-42:
22+
1 | let foo x y = (** incorrect doc for foo *)
23+
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
24+
Warning 50 [unexpected-docstring]: unattached documentation comment (ignored)
25+
26+
$ $MERLIN single document -position 1:18 -filename outside.ml << EOF
27+
> let bar = Test.foo
28+
> EOF
29+
{
30+
"class": "return",
31+
"value": "incorrect doc for foo",
32+
"notifications": []
33+
}

0 commit comments

Comments
 (0)