diff --git a/test/driver/standalone-supports-old-binary-ast/dune b/test/driver/standalone-supports-old-binary-ast/dune new file mode 100644 index 00000000..9b74d4f7 --- /dev/null +++ b/test/driver/standalone-supports-old-binary-ast/dune @@ -0,0 +1,19 @@ +(executable + (name identity_standalone) + (libraries ppxlib) + (modules identity_standalone)) + +(executable + (name print_magic_number) + (libraries astlib) + (modules print_magic_number)) + +(cram + (enabled_if + (or + (= %{system} linux) + (= %{system} linux_elf) + (= %{system} elf) + (= %{system} linux_eabihf) + (= %{system} linux_eabi))) + (deps identity_standalone.exe print_magic_number.exe)) diff --git a/test/driver/standalone-supports-old-binary-ast/identity_standalone.ml b/test/driver/standalone-supports-old-binary-ast/identity_standalone.ml new file mode 100644 index 00000000..e3cba404 --- /dev/null +++ b/test/driver/standalone-supports-old-binary-ast/identity_standalone.ml @@ -0,0 +1 @@ +let () = Ppxlib.Driver.standalone () diff --git a/test/driver/standalone-supports-old-binary-ast/print_magic_number.ml b/test/driver/standalone-supports-old-binary-ast/print_magic_number.ml new file mode 100644 index 00000000..ebac13c2 --- /dev/null +++ b/test/driver/standalone-supports-old-binary-ast/print_magic_number.ml @@ -0,0 +1,5 @@ +let magic_length = String.length Astlib.Config.ast_impl_magic_number +let buf = Bytes.create magic_length +let len = input stdin buf 0 magic_length +let s = Bytes.sub_string buf 0 len +let () = Printf.printf "Magic number: %s" s diff --git a/test/driver/standalone-supports-old-binary-ast/test.t/406_binary_ast b/test/driver/standalone-supports-old-binary-ast/test.t/406_binary_ast new file mode 100644 index 00000000..c9f48992 Binary files /dev/null and b/test/driver/standalone-supports-old-binary-ast/test.t/406_binary_ast differ diff --git a/test/driver/standalone-supports-old-binary-ast/test.t/run.t b/test/driver/standalone-supports-old-binary-ast/test.t/run.t new file mode 100644 index 00000000..c269cb16 --- /dev/null +++ b/test/driver/standalone-supports-old-binary-ast/test.t/run.t @@ -0,0 +1,14 @@ +Binary AST's of any by ppxlib supported OCaml version are supported. +The version is preserved. + + $ cat 406_binary_ast | ../print_magic_number.exe + Magic number: Caml1999N022 + + $ ../identity_standalone.exe --intf 406_binary_ast -o transformed --dump-ast + File "_none_", line 1: + Error: Internal error: invalid [@@ocaml.ppx.context { load_path }] pair syntax + [1] + + $ ../print_magic_number.exe < transformed + cannot open transformed: No such file + [2]