This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
20
unikernel/duniverse/base/test/allocation/test_zero_alloc.ml
Normal file
20
unikernel/duniverse/base/test/allocation/test_zero_alloc.ml
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
let[@zero_alloc] [@inline never] foo x = Base.Printf.failwithf "%d" x ()
|
||||
let[@zero_alloc] [@inline never] bar x y = Base.Printf.invalid_argf "%d" (x + y) ()
|
||||
|
||||
let%expect_test "foo" =
|
||||
let x = Sys.opaque_identity 5 in
|
||||
(try foo x with
|
||||
| Failure s ->
|
||||
print_string s;
|
||||
print_newline ());
|
||||
[%expect {| 5 |}]
|
||||
;;
|
||||
|
||||
let%expect_test "bar" =
|
||||
let x = Sys.opaque_identity 5 in
|
||||
(try bar x x with
|
||||
| Invalid_argument s ->
|
||||
print_string s;
|
||||
print_newline ());
|
||||
[%expect {| 10 |}]
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue