Skip to content

Commit

Permalink
test is_local directly
Browse files Browse the repository at this point in the history
  • Loading branch information
riaqn committed Aug 17, 2023
1 parent 0f56858 commit 1017496
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 9 deletions.
6 changes: 3 additions & 3 deletions ocaml/testsuite/tests/lib-obj/get_header.byte.reference
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
None
Some(wosize=1,color=0,tag=252)
Some(wosize=1,color=0,tag=0)
None false
Some(wosize=1,color=0,tag=252) false
Some(wosize=1,color=0,tag=0) false
12 changes: 9 additions & 3 deletions ocaml/testsuite/tests/lib-obj/get_header.ml
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,23 @@ let is_local repr =
(* immediate *)
let () =
let x = 42 in
Format.printf "%a\n" print_maybe_header (get_header_parsed (repr x))
let rp = repr x in
Format.printf "%a %a\n" print_maybe_header (get_header_parsed rp)
Format.pp_print_bool (is_local rp)

(* global*)
let () =
let s = "hello" in
let _r = ref s in
Format.printf "%a\n" print_maybe_header (get_header_parsed (repr s))
let rp = repr s in
Format.printf "%a %a\n" print_maybe_header (get_header_parsed rp)
Format.pp_print_bool (is_local rp)

(* local *)
let foo x =
let local_ s = ref x in
Format.printf "%a\n" print_maybe_header (get_header_parsed (repr s))
let rp = repr s in
Format.printf "%a %a\n" print_maybe_header (get_header_parsed rp)
Format.pp_print_bool (is_local rp)

let () = foo 42
6 changes: 3 additions & 3 deletions ocaml/testsuite/tests/lib-obj/get_header.opt.reference
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
None
Some(wosize=1,color=3,tag=252)
Some(wosize=1,color=2,tag=0)
None false
Some(wosize=1,color=3,tag=252) false
Some(wosize=1,color=2,tag=0) true

0 comments on commit 1017496

Please sign in to comment.