Skip to content

Commit d6180a4

Browse files
committed
adding test for multilines in .mli
Signed-off-by: Paul-Elliot <[email protected]>
1 parent d23b06b commit d6180a4

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed

test/bin/mdx-test/expect/dune.inc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,18 @@
275275
(alias runtest)
276276
(action (diff multilines/test-case.md multilines.actual)))
277277

278+
(rule
279+
(target multilines-mli.actual)
280+
(deps (package mdx) (source_tree multilines-mli))
281+
(action
282+
(with-stdout-to %{target}
283+
(chdir multilines-mli
284+
(run ocaml-mdx test --output - test-case.mli)))))
285+
286+
(rule
287+
(alias runtest)
288+
(action (diff multilines-mli/test-case.mli multilines-mli.actual)))
289+
278290
(rule
279291
(target non-det.actual)
280292
(deps (package mdx) (source_tree non-det))
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
(**
2+
3+
In OCaml docstring everything is indented with two spaces
4+
5+
Test multi-lines shell commands:
6+
7+
{@sh[
8+
$ for i in `seq 1 10`; do \
9+
> echo $i; \
10+
> done
11+
1
12+
...
13+
10
14+
]}
15+
16+
This works for normal OCaml fragments:
17+
18+
{[
19+
let rec fact = function
20+
| 1 -> 1
21+
| n -> n * fact (n-1)
22+
]}
23+
24+
The formatting for multilines in .mli files is the following:
25+
- Everything is indented with two spaces after the column of the opening code
26+
block.
27+
28+
{[
29+
match None with
30+
| None -> ()
31+
| Some a -> match a with
32+
| None -> ()
33+
| Some b -> b
34+
]}
35+
36+
But it does not work fine for toplevel (see [multilines/test-case.md] for the
37+
correct definition of [fact]):
38+
39+
{[
40+
# let rec fact = function;;
41+
Line 1, characters 24-26:
42+
Error: Syntax error
43+
]}
44+
*)

0 commit comments

Comments
 (0)