diff --git a/test/blackbox-tests/test-cases/reason/cppome.re b/test/blackbox-tests/test-cases/reason/cppome.re new file mode 100644 index 00000000..e69de29b diff --git a/test/blackbox-tests/test-cases/reason/cppome.rei b/test/blackbox-tests/test-cases/reason/cppome.rei new file mode 100644 index 00000000..e69de29b diff --git a/test/blackbox-tests/test-cases/reason/jbuild b/test/blackbox-tests/test-cases/reason/jbuild index 63d27d13..4443e620 100644 --- a/test/blackbox-tests/test-cases/reason/jbuild +++ b/test/blackbox-tests/test-cases/reason/jbuild @@ -5,7 +5,9 @@ (library ((name rlib) - (public_name rlib))) + (public_name rlib) + (preprocess + (per_module ((action (run ./pp/reasononlypp.exe ${<})) (cppome)))))) ;; we want to make sure that .rei files are present (alias diff --git a/test/blackbox-tests/test-cases/reason/pp/jbuild b/test/blackbox-tests/test-cases/reason/pp/jbuild new file mode 100644 index 00000000..c385afe2 --- /dev/null +++ b/test/blackbox-tests/test-cases/reason/pp/jbuild @@ -0,0 +1,4 @@ +(jbuild_version 1) + +(executable + ((name reasononlypp))) diff --git a/test/blackbox-tests/test-cases/reason/pp/reasononlypp.ml b/test/blackbox-tests/test-cases/reason/pp/reasononlypp.ml new file mode 100644 index 00000000..cb474458 --- /dev/null +++ b/test/blackbox-tests/test-cases/reason/pp/reasononlypp.ml @@ -0,0 +1,16 @@ + +let () = + let fname = Sys.argv.(1) in + if Filename.check_suffix fname ".re" + || Filename.check_suffix fname ".rei" then ( + let ch = open_in fname in + let rec loop () = + match input_line ch with + | exception End_of_file -> () + | line -> print_endline line; loop () in + loop (); + close_in ch + ) else ( + Format.eprintf "%s is not a reason source@.%!" fname; + exit 1 + ) diff --git a/test/blackbox-tests/test-cases/reason/run.t b/test/blackbox-tests/test-cases/reason/run.t index fafa5b56..2a6771b2 100644 --- a/test/blackbox-tests/test-cases/reason/run.t +++ b/test/blackbox-tests/test-cases/reason/run.t @@ -1,58 +1,19 @@ $ $JBUILDER runtest -j1 --root . refmt bar.re.ml + refmt cppome.re.ml + ocamldep pp/reasononlypp.depends.ocamldep-output refmt hello.re.ml refmt pped.re.ml ocamlc rlib.{cmi,cmo,cmt} + refmt cppome.re.mli refmt foo.re.mli refmt hello.re.mli refmt pped.re.mli - ocamldep rlib.depends.ocamldep-output + ocamlc pp/reasononlypp.{cmi,cmo,cmt} ocamlopt rlib.{cmx,o} - ocamldep rlib.dependsi.ocamldep-output - ocamlc rlib__Bar.{cmi,cmti} - ocamlc rlib__Foo.{cmi,cmti} - ocamlc rlib__Hello.{cmi,cmti} - ocamlc rlib__Pped.{cmi,cmti} - ocamlc rlib__Bar.{cmo,cmt} - ocamlopt rlib__Bar.{cmx,o} - ocamlc rlib__Foo.{cmo,cmt} - ocamlopt rlib__Foo.{cmx,o} - ocamlc rlib__Hello.{cmo,cmt} - ocamlopt rlib__Hello.{cmx,o} - ocamlc rlib__Pped.{cmo,cmt} - ocamlopt rlib__Pped.{cmx,o} - ocamlc rlib.cma - ocamlopt rlib.{a,cmxa} - ocamlopt rlib.cmxs - lib: [ - "_build/install/default/lib/rlib/META" {"META"} - "_build/install/default/lib/rlib/opam" {"opam"} - "_build/install/default/lib/rlib/rlib__Bar.cmi" - "_build/install/default/lib/rlib/rlib__Bar.cmx" - "_build/install/default/lib/rlib/rlib__Bar.cmt" - "_build/install/default/lib/rlib/rlib__Bar.cmti" - "_build/install/default/lib/rlib/bar.mli" - "_build/install/default/lib/rlib/rlib__Foo.cmi" - "_build/install/default/lib/rlib/rlib__Foo.cmx" - "_build/install/default/lib/rlib/rlib__Foo.cmt" - "_build/install/default/lib/rlib/rlib__Foo.cmti" - "_build/install/default/lib/rlib/foo.rei" - "_build/install/default/lib/rlib/rlib__Hello.cmi" - "_build/install/default/lib/rlib/rlib__Hello.cmx" - "_build/install/default/lib/rlib/rlib__Hello.cmt" - "_build/install/default/lib/rlib/rlib__Hello.cmti" - "_build/install/default/lib/rlib/hello.rei" - "_build/install/default/lib/rlib/rlib__Pped.cmi" - "_build/install/default/lib/rlib/rlib__Pped.cmx" - "_build/install/default/lib/rlib/rlib__Pped.cmt" - "_build/install/default/lib/rlib/rlib__Pped.cmti" - "_build/install/default/lib/rlib/pped.rei" - "_build/install/default/lib/rlib/rlib.cmi" - "_build/install/default/lib/rlib/rlib.cmx" - "_build/install/default/lib/rlib/rlib.cmt" - "_build/install/default/lib/rlib/rlib.ml-gen" - "_build/install/default/lib/rlib/rlib.cma" - "_build/install/default/lib/rlib/rlib.cmxa" - "_build/install/default/lib/rlib/rlib.a" - "_build/install/default/lib/rlib/rlib.cmxs" - ] + ocamlopt pp/reasononlypp.{cmx,o} + ocamlopt pp/reasononlypp.exe + reasononlypp cppome.re.pp.ml (exit 1) + (cd _build/default && ./pp/reasononlypp.exe cppome.re.ml) > _build/default/cppome.re.pp.ml + cppome.re.ml is not a reason source + [1]