flan/test/programs/dev-temp-stop.flan

28 lines
760 B
Plaintext

;;;; A program that stops while a live frame holds text in the temp allocator.
;;;; [hold] formats a number, then calls [fetch], which errors with nothing
;;;; handling it, so the program stops with [hold]'s text still in use.
;;;; Expressions evaluated at the stop format numbers of their own; after the
;;;; retry restart the program prints [hold]'s text, which has to be intact.
;;;; test_dev.ml drives it.
(import agent "vendor:agent")
(defstruct Missing [id i32])
(defn fetch [] i32
(restart-case
(do (error (Missing {.id 1})) 0)
(retry [] 7)))
(defn hold [] i32
(let [s (string (i64->bytes 4242))
r (fetch)]
(println s)
r))
(defn main [] i32
(agent/start)
(println (hold))
(dotimes [i 4000]
(agent/wait 5))
0)