Skip to content

Commit

Permalink
Extend the tests:
Browse files Browse the repository at this point in the history
1) Make sure that extraction to JSON fails
2) Make sure that extracting callbacks can be reverted.
  • Loading branch information
eladrion committed Nov 14, 2023
1 parent ebf18b9 commit f1ea5b8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
7 changes: 6 additions & 1 deletion test-suite/failure/extraction_ffi.v
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ Extraction Language Scheme.
Fail Extract Foreign Constant ax_fun => "my_c_fun".
Fail Extract Callback "call_my_fun" my_fun.

(* Extraction of foreign constant and callback for JSON must fail *)
Extraction Language JSON.
Fail Extract Foreign Constant ax_fun => "my_c_fun".
Fail Extract Callback "call_my_fun" my_fun.

(* Extraction of foreign constant for already defined ml function must fail. *)
Extraction Language OCaml.
Extract Constant ax_fun => "my_ml_fun".
Fail Extract Foreign Constant ax_fun => "my_c_fun".
Fail Extract Foreign Constant ax_fun => "my_c_fun".
4 changes: 4 additions & 0 deletions test-suite/output/Extraction_ffi.out
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ let exact_fun2 a =
add (ax_fun a) (S O)

let _ = Stdlib.Callback.register "call_exact_fun" exact_fun2
(** val exact_fun2 : nat -> nat **)

let exact_fun2 a =
add (ax_fun a) (S O)
6 changes: 5 additions & 1 deletion test-suite/output/Extraction_ffi.v
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Extraction exact_fun.
Extract Foreign Constant exact_fun => "my_exact_c_fun".
Extraction exact_fun.

(* Now, exact_fun is an entry point exposed to C. *)
(* Now, exact_fun is an entry point exposed to C *)
Extract Callback "call_exact_fun" exact_fun2.
Extraction exact_fun2.

(* Now we make sure that a callback registration can be reverted *)
Reset Extraction Callback.
Extraction exact_fun2.

0 comments on commit f1ea5b8

Please sign in to comment.