flan/test/test_cider.ml
Joseph Ferano 94b78a1a83 A value you can walk into, because the walk has a bound
C-x C-e renders once and stops at depth 4 and span 8. A field past either
comes back as "..." and nothing recovers it from the echo area. Re-rooting
the walk at that field renders it from depth 0, so the bound moves with you
— that, and not tidiness, is why an inspector is worth having beside the
expression evaluator.

CIDER keeps its inspector stack on the server because a JVM value can be
retained. Nothing here can: a Flan value has no header and the thunk that
rendered it is dlclosed the moment it returns. So the stack is a stack of
expressions on this side, and going into a field means sending a different
one — (.pos b) where the last one was b. It costs a re-evaluation per step,
which buys a view that is never stale and is why refresh is a key someone
presses rather than a timer.

Driven from fixtures, which is also the only way the cases a live program
will not hold still for get tested at all.
2026-09-12 04:08:13 +07:00

28 lines
1.2 KiB
OCaml

(* The inspector and the break buffer, driven from fixtures.
Unlike test_emacs.ml there is no daemon and no running program behind this,
and that is the point rather than a shortcut. Both buffers are functions
from a reply's data to text with properties on it, and every interesting way
they can be wrong is on that side: a struct the reader mis-parses, a
shadowed restart drawn as though it could be taken, a section quietly
omitted where it should have been refused. Fixtures also reach the states a
live program is hard to hold still in — a value past the renderer's depth
bound, two restarts sharing a name, a frame with locals in it at all.
Skipped, not failed, where there is no emacs: the compiler does not depend
on one. *)
let () =
if Sys.command "command -v emacs > /dev/null 2>&1" <> 0 then
print_endline "cider: skipped (no emacs on PATH)"
else
let code =
Sys.command
"emacs -Q --batch -L ../../../emacs -l ../../../emacs/test-flan-cider.el 2>&1"
in
if code = 0 then print_endline "cider: all tests passed"
else begin
Printf.printf "\nthe inspector/break buffer tests exited %d\n" code;
exit 1
end