Skip to content

Commit 0ff4c3d

Browse files
committed
Add tests for module-indent option
1 parent 71d5ee4 commit 0ff4c3d

File tree

6 files changed

+197
-23
lines changed

6 files changed

+197
-23
lines changed

test/passing/gen/dune.inc

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3993,6 +3993,24 @@
39933993
(package ocamlformat)
39943994
(action (diff module_attributes.ml.err module_attributes.ml.stderr)))
39953995

3996+
(rule
3997+
(deps .ocamlformat)
3998+
(package ocamlformat)
3999+
(action
4000+
(with-stdout-to module_indent.ml.stdout
4001+
(with-stderr-to module_indent.ml.stderr
4002+
(run %{bin:ocamlformat} --name module_indent.ml --margin-check --module-indent=4 %{dep:../tests/module_indent.ml})))))
4003+
4004+
(rule
4005+
(alias runtest)
4006+
(package ocamlformat)
4007+
(action (diff module_indent.ml.ref module_indent.ml.stdout)))
4008+
4009+
(rule
4010+
(alias runtest)
4011+
(package ocamlformat)
4012+
(action (diff module_indent.ml.err module_indent.ml.stderr)))
4013+
39964014
(rule
39974015
(deps .ocamlformat)
39984016
(package ocamlformat)
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module type M = sig
2+
type t
3+
4+
val f : (string * int) list -> int
5+
6+
module type Inner = sig
7+
type inner
8+
9+
val f : int -> int
10+
end
11+
end
12+
13+
module A : sig
14+
type t
15+
16+
val f : (string * int) list -> int
17+
end = struct
18+
type t
19+
20+
let f s l = 0
21+
end
22+
23+
module Core = struct
24+
module Int = struct
25+
module T = struct
26+
type t = int
27+
28+
let compare = compare
29+
let ( + ) x y = x + y
30+
end
31+
32+
include T
33+
module Map = Map.Make (T)
34+
end
35+
36+
module Std = struct
37+
module Int = Int
38+
end
39+
end
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module type M = sig
2+
type t
3+
4+
val f : (string * int) list -> int
5+
6+
module type Inner = sig
7+
type inner
8+
9+
val f : int -> int
10+
end
11+
end
12+
13+
module A : sig
14+
type t
15+
16+
val f : (string * int) list -> int
17+
end = struct
18+
type t
19+
20+
let f s l = 0
21+
end
22+
23+
module Core = struct
24+
module Int = struct
25+
module T = struct
26+
type t = int
27+
28+
let compare = compare
29+
let ( + ) x y = x + y
30+
end
31+
32+
include T
33+
module Map = Map.Make (T)
34+
end
35+
36+
module Std = struct
37+
module Int = Int
38+
end
39+
end
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
module type M = sig
2+
type t
3+
4+
val f : (string * int) list -> int
5+
6+
module type Inner = sig
7+
type inner
8+
9+
val f : int -> int
10+
end
11+
end
12+
13+
module A : sig
14+
type t
15+
16+
val f : (string * int) list -> int
17+
end = struct
18+
type t
19+
20+
let f s l = 0
21+
end
22+
23+
module Core = struct
24+
module Int = struct
25+
module T = struct
26+
type t = int
27+
28+
let compare = compare
29+
let ( + ) x y = x + y
30+
end
31+
32+
include T
33+
module Map = Map.Make (T)
34+
end
35+
36+
module Std = struct
37+
module Int = Int
38+
end
39+
end
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
module type M = sig
2+
type t
3+
4+
val f : (string * int) list -> int
5+
6+
module type Inner = sig
7+
type inner
8+
9+
val f : int -> int
10+
end
11+
end
12+
13+
module A : sig
14+
type t
15+
16+
val f : (string * int) list -> int
17+
end = struct
18+
type t
19+
20+
let f s l = 0
21+
end
22+
23+
module Core = struct
24+
module Int = struct
25+
module T = struct
26+
type t = int
27+
28+
let compare = compare
29+
30+
let ( + ) x y = x + y
31+
end
32+
33+
include T
34+
module Map = Map.Make (T)
35+
end
36+
37+
module Std = struct
38+
module Int = Int
39+
end
40+
end
Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,39 @@
11
module type M = sig
2-
type t
2+
type t
33

4-
val f : (string * int) list -> int
4+
val f : (string * int) list -> int
55

6-
module type Inner = sig
7-
type inner
6+
module type Inner = sig
7+
type inner
88

9-
val f : int -> int
10-
end
9+
val f : int -> int
10+
end
1111
end
1212

1313
module A : sig
14-
type t
14+
type t
1515

16-
val f : (string * int) list -> int
16+
val f : (string * int) list -> int
1717
end = struct
18-
type t
18+
type t
1919

20-
let f s l = 0
20+
let f s l = 0
2121
end
2222

2323
module Core = struct
24-
module Int = struct
25-
module T = struct
26-
type t = int
24+
module Int = struct
25+
module T = struct
26+
type t = int
2727

28-
let compare = compare
29-
let ( + ) x y = x + y
30-
end
28+
let compare = compare
29+
let ( + ) x y = x + y
30+
end
3131

32-
include T
33-
module Map = Map.Make (T)
34-
end
32+
include T
33+
module Map = Map.Make (T)
34+
end
3535

36-
module Std = struct
37-
module Int = Int
38-
end
36+
module Std = struct
37+
module Int = Int
38+
end
3939
end
40-

0 commit comments

Comments
 (0)