Skip to content

Commit

Permalink
normalize test output to also include whitespace in tuples for older …
Browse files Browse the repository at this point in the history
…OCaml versions

See ocaml/dune#697 (comment)
  • Loading branch information
vogler committed Feb 25, 2020
1 parent 11b98a6 commit 4558030
Showing 1 changed file with 16 additions and 4 deletions.
20 changes: 16 additions & 4 deletions dune
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,22 @@
)

(rule
(targets test.actual.ml)
(deps (:pp standalone.exe) (:input test.ml))
(action (run ./%{pp} --impl %{input} -o %{targets})))
(targets test.actual.ml)
(deps (:pp standalone.exe) (:input test.ml))
(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
(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})))
)

(rule
(alias runtest)
(action (diff test.expected.ml test.actual.ml)))
; (action (diff test.expected.ml test.actual.ml))
; (action (run diff -w test.expected.ml test.actual.ml)) ; does not work: https://github.com/ocaml/dune/issues/697#issuecomment-590785703
(action (diff test.expected.ml test.actual.norm.ml))
)

0 comments on commit 4558030

Please sign in to comment.