(executables
 (names main)
 (libraries toplevel_expect_test js_of_ocaml-ppx stdlib)
 (modes byte)
 (link_flags (-linkall)))

(rule
 (targets ppx.mlt.corrected)
 (enabled_if
  (and
   (>= %{ocaml_version} 5.4)
   (< %{ocaml_version} 5.5)))
 (action
  (run %{exe:main.bc} %{dep:ppx.mlt})))

(rule
 (targets gen.mlt.corrected)
 (enabled_if
  (and
   (>= %{ocaml_version} 5.4)
   (< %{ocaml_version} 5.5)))
 (action
  (run %{exe:main.bc} %{dep:gen.mlt})))

(rule
 (alias runtest)
 (package js_of_ocaml-ppx)
 (enabled_if
  (and
   (>= %{ocaml_version} 5.4)
   (< %{ocaml_version} 5.5)))
 (action
  (diff ppx.mlt ppx.mlt.corrected)))

(rule
 (alias runtest)
 (package js_of_ocaml-ppx)
 (enabled_if
  (and
   (>= %{ocaml_version} 5.4)
   (< %{ocaml_version} 5.5)))
 (action
  (diff gen.mlt gen.mlt.corrected)))
