-
Notifications
You must be signed in to change notification settings - Fork 99
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for standalone driver support of old binary ASTs
Signed-off-by: Nathan Rebours <[email protected]>
- Loading branch information
Showing
5 changed files
with
39 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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)) |
1 change: 1 addition & 0 deletions
1
test/driver/standalone-supports-old-binary-ast/identity_standalone.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
let () = Ppxlib.Driver.standalone () |
5 changes: 5 additions & 0 deletions
5
test/driver/standalone-supports-old-binary-ast/print_magic_number.ml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Binary file added
BIN
+460 Bytes
test/driver/standalone-supports-old-binary-ast/test.t/406_binary_ast
Binary file not shown.
14 changes: 14 additions & 0 deletions
14
test/driver/standalone-supports-old-binary-ast/test.t/run.t
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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] |