Skip to content

Commit

Permalink
Test cases for label comment documentation (#1526)
Browse files Browse the repository at this point in the history
from mheiber/more-label-comment-examples
  • Loading branch information
voodoos authored Nov 17, 2022
2 parents 32d0617 + 25f7f9d commit 4065d1a
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ undefined
- vim: load the plugin when necessary if it wasn’t loaded before (#1511)
+ test suite
- add tests for constructors' documentation (#1511)
- add test cases for label comment documentation (#1526, @mheiber)

merlin 4.6
==========
Expand Down
66 changes: 66 additions & 0 deletions tests/test-dirs/document/label-comments.t
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
Examples adapted from https://v2.ocaml.org/manual/doccomments.html#ss:label-comments.
We do not currently show these comments:

$ cat >main.ml <<EOF
> type t1 =
> lbl_a:unit (** lbl_a comment *) ->
> lbl_b:unit (** lbl_b comment *) -> unit
> let _test (f: t1) =
> let _ = f ~lbl_a:() ~lbl_b:() in
> ()
> EOF

FIXME: expected "lbl_b comment"

$ $MERLIN single document -position 5:15 \
> -filename main.ml <main.ml | jq '.value'
"Not a valid identifier"

$ cat >main.ml <<EOF
> type t = <
> meth_a: unit; (** meth_a comment *)
> meth_b: unit; (** meth_b comment *)
> >
> let _test (o: t3) =
> o#meth_b
> EOF

FIXME: expected "meth_b comment"

$ $MERLIN single document -position 6:6 \
> -filename main.ml <main.ml | jq '.value'
"Not in environment 'meth_b'"

$ cat >main.ml <<"EOF"
> type t = [
> | `Poly_a (** Poly_a comment *)
> | `Poly_b (** Poly_b comment *)
> ]
> let _: t4 =
> `Poly_b
> EOF

FIXME: expected "Poly_b comment"

$ $MERLIN single document -position 6:4 \
> -filename main.ml <main.ml | jq '.value'
"Not a valid identifier"

FIXME: expected "fld_b comment"

$ cat >main.ml <<EOF
> type t2 = {
> fld_a: unit; (** fld_a comment *)
> fld_b: unit; (** fld_b comment *)
> fld_c: unit;
> }
> let _ = {
> fld_a = ();
> fld_b = ();
> fld_c = ()
> }
> EOF

$ $MERLIN single document -position 8:4 \
> -filename main.ml <main.ml | jq '.value'
"fld_a comment"

0 comments on commit 4065d1a

Please sign in to comment.