Skip to content

Commit

Permalink
normalize tests by removing all trailing whitespace which some OCaml …
Browse files Browse the repository at this point in the history
…versions add

https://ci.ocaml.org/ocaml/opam-repository/pr/15897?test=3%20Compilers
Test failed for OCaml 4.02 because of no trailing whitespace after the declared variants:
-  | A of int
-  | B of int
+  | A of int
+  | B of int
And failed for 4.03-4.05 with extra trailing whitespace (after _ pattern or last case?):
-  function | (A x, _) when x <> 0 -> 1 | (_, A x) when x <> 0 -> 1 | _ -> 2
+  function | (A x, _) when x <> 0 -> 1 | (_, A x) when x <> 0 -> 1 | _ -> 2
 let g x =
   match x with
   | (A x, _) when x <> 0 -> 1
   | (_, A x) when x <> 0 -> 1
   | (B x, _) when x <> 0 -> 1
-  | _ -> 2
+  | _ -> 2
  • Loading branch information
vogler committed Feb 26, 2020
1 parent 8d686f2 commit 2c94051
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@
(action (run ./%{pp} --impl %{input} -o %{targets}))
)

; The PPX for OCaml 4.02-4.05 prints no whitespace in tuples, so we add them. See https://github.com/ocaml/opam-repository/pull/15897
; The PPX for OCaml 4.02-4.05 prints no whitespace in tuples, so we add them. They also add trailing whitespace in some places, which we remove everywhere. See https://github.com/ocaml/opam-repository/pull/15897
(rule
(targets test.actual.norm.ml)
(deps (:input test.actual.ml))
; sed -E 's/,([^ ])/, \1/' test.actual.ml > test.actual.norm.ml
(action (with-stdout-to test.actual.norm.ml (run sed -E "s/,([^ ])/, \\1/g" %{input})))
; sed -E 's/,([^ ])/, \1/g; s/ *$//' test.actual.ml > test.actual.norm.ml
(action (with-stdout-to test.actual.norm.ml (run sed -E "s/,([^ ])/, \\1/g; s/ *$//" %{input})))
)

(rule
Expand Down
4 changes: 2 additions & 2 deletions test.expected.ml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
type t =
| A of int
| B of int
| A of int
| B of int
let f =
function | (A x, _) when x <> 0 -> 1 | (_, A x) when x <> 0 -> 1 | _ -> 2
let g x =
Expand Down

0 comments on commit 2c94051

Please sign in to comment.