diff --git a/test/test_dev.ml b/test/test_dev.ml index 659a925..8d7f68e 100644 --- a/test/test_dev.ml +++ b/test/test_dev.ml @@ -537,7 +537,26 @@ let () = | Some o when Filename.check_suffix o ".so" -> () | o -> fail "the code did not come from a .so: %s" (Option.value ~default:"" o) - end + end; + (* The other presentation borrow, and the one that needs a body with + somewhere to jump to: a branch inside the function reads as [L0] + rather than as an address into an object nobody will open. *) + let r = + request c + "(:op \"eval\" :code \"(defn wind [n i32] i32 (let [acc 0] (dotimes [i n] (set acc (+ acc i))) acc))\" :file \"/tmp/disasm.flan\")" + in + if status r <> "ok" then + fail "installing a body with a loop in it: %s" + (Option.value ~default:"" (Wire.string_field r "message")) + else + let r = request c "(:op \"disassemble\" :name \"wind\" :form \"asm\")" in + if status r <> "ok" then + fail "the machine code of a loop: %s" + (Option.value ~default:"" (Wire.string_field r "message")) + else if not (has (text r) "L0:") then + fail "a branch target is not labelled: %S" (text r) + else if has (text r) "