Rewrite a test so that it passes also on the bytecode backend

Rewrite a test to shorten the lexical scope of the string it builds
because, in the bytecode backend, a variable is deemed live at least as
long as its lexical scope.

Reference: https://github.com/ocaml/ocaml/pull/10071
This commit is contained in:
Samuel Hym 2022-12-16 19:50:06 +01:00 committed by Fardale
parent d1de46c7a9
commit 1367d5b855

View file

@ -612,10 +612,11 @@ q
(* check it frees memory properly *)
t @@ fun () ->
let s = "coucou" ^ "lol" in
let w = Weak.create 1 in
let v =
let s = "coucou" ^ "lol" in
Weak.set w 0 (Some s) ;
let v = of_list [ "a"; s ] in
of_list [ "a"; s ] in
filter_in_place (fun s -> String.length s <= 1) v;
assert_equal 1 (length v);
assert_equal "a" (get v 0);