From 2c940519e6c638be2d291a6cc2fab7d9ab79a854 Mon Sep 17 00:00:00 2001 From: Ralf Vogler Date: Wed, 26 Feb 2020 22:12:53 +0100 Subject: [PATCH] normalize tests by removing all trailing whitespace which some OCaml 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 --- dune | 6 +++--- test.expected.ml | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dune b/dune index de23e0f..5113377 100644 --- a/dune +++ b/dune @@ -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 diff --git a/test.expected.ml b/test.expected.ml index 1792591..5b5979c 100644 --- a/test.expected.ml +++ b/test.expected.ml @@ -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 =