This commit is contained in:
parent
aa2ff7b2f0
commit
2f3113f55d
11742 changed files with 1223940 additions and 0 deletions
36
unikernel/duniverse/base/test/test_obj_local.ml
Normal file
36
unikernel/duniverse/base/test/test_obj_local.ml
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
open! Import
|
||||
open! Exported_for_specific_uses.Obj_local
|
||||
|
||||
(* immediate *)
|
||||
let%test_unit _ =
|
||||
[%test_result: stack_or_heap]
|
||||
(let x = 42 in
|
||||
stack_or_heap (repr x))
|
||||
~expect:Immediate
|
||||
;;
|
||||
|
||||
(* global*)
|
||||
let%test_unit _ =
|
||||
[%test_result: stack_or_heap]
|
||||
(let s = "hello" in
|
||||
let _r = ref s in
|
||||
stack_or_heap (repr s))
|
||||
~expect:Heap
|
||||
;;
|
||||
|
||||
let stack_enabled =
|
||||
match Sys.backend_type with
|
||||
| Sys.Native -> true
|
||||
| _ -> false
|
||||
;;
|
||||
|
||||
(* local *)
|
||||
let%test_unit _ =
|
||||
[%test_result: stack_or_heap]
|
||||
(let foo x =
|
||||
let s = ref x in
|
||||
stack_or_heap (repr s) [@nontail]
|
||||
in
|
||||
foo 42)
|
||||
~expect:(if stack_enabled then Stack else Heap)
|
||||
;;
|
||||
Loading…
Add table
Add a link
Reference in a new issue