mirror of
https://github.com/aantron/dream.git
synced 2025-10-06 00:05:19 -04:00
parent
32bbf56de8
commit
a169c107b0
10
.ocamlformat
10
.ocamlformat
@ -1,13 +1,21 @@
|
||||
version = 0.18.0
|
||||
profile = conventional
|
||||
|
||||
leading-nested-match-parens = false
|
||||
leading-nested-match-parens = false
|
||||
align-constructors-decl = true
|
||||
align-variants-decl = true
|
||||
space-around-variants = false
|
||||
space-around-arrays = false
|
||||
space-around-lists = false
|
||||
space-around-records = false
|
||||
break-before-in = auto
|
||||
break-infix = fit-or-vertical
|
||||
break-separators = after
|
||||
space-around-records = true
|
||||
break-cases = all
|
||||
cases-exp-indent = 2
|
||||
exp-grouping = preserve
|
||||
nested-match = align
|
||||
if-then-else = fit-or-vertical
|
||||
let-and = sparse
|
||||
type-decl = sparse
|
||||
|
10
Makefile
10
Makefile
@ -68,6 +68,16 @@ clean : clean-coverage
|
||||
make --no-print-directory -C docs/web clean
|
||||
rm -rf src/graphiql/node_modules dream-* _release
|
||||
|
||||
.PHONY : test-ocamlformat
|
||||
test-ocamlformat :
|
||||
touch test/ocamlformat/test.expect.ml
|
||||
ocamlformat test/ocamlformat/test.ml > test/ocamlformat/test.actual.ml
|
||||
diff -u3 test/ocamlformat/test.expect.ml test/ocamlformat/test.actual.ml
|
||||
|
||||
.PHONY : test-ocamlformat-promote
|
||||
test-ocamlformat-promote :
|
||||
ocamlformat test/ocamlformat/test.ml > test/ocamlformat/test.expect.ml
|
||||
|
||||
.PHONY : utop
|
||||
utop :
|
||||
dune utop
|
||||
|
68
test/ocamlformat/test.actual.ml
Normal file
68
test/ocamlformat/test.actual.ml
Normal file
@ -0,0 +1,68 @@
|
||||
(* Failure: space still inserted near delimiters when not type-decl = sparse. *)
|
||||
type t = {
|
||||
a : string;
|
||||
b : string;
|
||||
c : string;
|
||||
}
|
||||
|
||||
let t =
|
||||
{
|
||||
a = "a_pretty_long_string_to_force_separate_line";
|
||||
b = "a_pretty_long_string_to_force_separate_line";
|
||||
c = "a_pretty_long_string_to_force_separate_line";
|
||||
}
|
||||
|
||||
type t =
|
||||
| A of int
|
||||
| B of string
|
||||
| C of unit
|
||||
|
||||
(* Failure: the bracket is set on the first line rather than having unifrom
|
||||
lines. *)
|
||||
type t =
|
||||
[ `A of int
|
||||
| `B of string
|
||||
| `C of unit ]
|
||||
|
||||
let list = [a; b; c]
|
||||
|
||||
let list =
|
||||
[
|
||||
a_very_long_identifier_or_expression_one;
|
||||
a_very_long_identifier_or_expression_two;
|
||||
a_very_long_identifier_or_expression_three;
|
||||
]
|
||||
|
||||
let bool =
|
||||
match true with
|
||||
| true -> false
|
||||
| false -> true
|
||||
|
||||
let () =
|
||||
match () with
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
(* Failure: begin...end replaced by parentheses. *)
|
||||
let () =
|
||||
match true with
|
||||
| true -> (
|
||||
match () with
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar")
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
let f = function
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
let () =
|
||||
if true then
|
||||
()
|
||||
else
|
||||
()
|
68
test/ocamlformat/test.expect.ml
Normal file
68
test/ocamlformat/test.expect.ml
Normal file
@ -0,0 +1,68 @@
|
||||
(* Failure: space still inserted near delimiters when not type-decl = sparse. *)
|
||||
type t = {
|
||||
a : string;
|
||||
b : string;
|
||||
c : string;
|
||||
}
|
||||
|
||||
let t =
|
||||
{
|
||||
a = "a_pretty_long_string_to_force_separate_line";
|
||||
b = "a_pretty_long_string_to_force_separate_line";
|
||||
c = "a_pretty_long_string_to_force_separate_line";
|
||||
}
|
||||
|
||||
type t =
|
||||
| A of int
|
||||
| B of string
|
||||
| C of unit
|
||||
|
||||
(* Failure: the bracket is set on the first line rather than having unifrom
|
||||
lines. *)
|
||||
type t =
|
||||
[ `A of int
|
||||
| `B of string
|
||||
| `C of unit ]
|
||||
|
||||
let list = [a; b; c]
|
||||
|
||||
let list =
|
||||
[
|
||||
a_very_long_identifier_or_expression_one;
|
||||
a_very_long_identifier_or_expression_two;
|
||||
a_very_long_identifier_or_expression_three;
|
||||
]
|
||||
|
||||
let bool =
|
||||
match true with
|
||||
| true -> false
|
||||
| false -> true
|
||||
|
||||
let () =
|
||||
match () with
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
(* Failure: begin...end replaced by parentheses. *)
|
||||
let () =
|
||||
match true with
|
||||
| true -> (
|
||||
match () with
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar")
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
let f = function
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
let () =
|
||||
if true then
|
||||
()
|
||||
else
|
||||
()
|
72
test/ocamlformat/test.ml
Normal file
72
test/ocamlformat/test.ml
Normal file
@ -0,0 +1,72 @@
|
||||
(* Failure: space still inserted near delimiters when not type-decl = sparse. *)
|
||||
type t = {
|
||||
a : string;
|
||||
b : string;
|
||||
c : string;
|
||||
}
|
||||
|
||||
let t = {
|
||||
a = "a_pretty_long_string_to_force_separate_line";
|
||||
b = "a_pretty_long_string_to_force_separate_line";
|
||||
c = "a_pretty_long_string_to_force_separate_line";
|
||||
}
|
||||
|
||||
type t =
|
||||
| A of int
|
||||
| B of string
|
||||
| C of unit
|
||||
|
||||
(* Failure: the bracket is set on the first line rather than having unifrom
|
||||
lines. *)
|
||||
type t = [
|
||||
| `A of int
|
||||
| `B of string
|
||||
| `C of unit
|
||||
]
|
||||
|
||||
let list = [
|
||||
a;
|
||||
b;
|
||||
c;
|
||||
]
|
||||
|
||||
let list = [
|
||||
a_very_long_identifier_or_expression_one;
|
||||
a_very_long_identifier_or_expression_two;
|
||||
a_very_long_identifier_or_expression_three;
|
||||
]
|
||||
|
||||
let bool =
|
||||
match true with
|
||||
| true -> false
|
||||
| false -> true
|
||||
|
||||
let () =
|
||||
match () with
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
(* Failure: begin...end replaced by parentheses. *)
|
||||
let () =
|
||||
match true with
|
||||
| true ->
|
||||
begin match () with
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
end
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
let f = function
|
||||
| () ->
|
||||
print_endline "foo";
|
||||
print_endline "bar"
|
||||
|
||||
let () =
|
||||
if true then
|
||||
()
|
||||
else
|
||||
()
|
Loading…
x
Reference in New Issue
Block a user