gleamunison/cli_tape_to_test

gleamunison tape-to-test <file.lisp> <def> <tape.json> — turn a recorded effect transcript into a permanent regression test. The generated file re-states the subject definitions, adds a mock handler that pins the recorded args and result (the mock itself asserts the args via Test.expect, so a changed prompt/call fails the suite), and a test_ def asserting the recorded final value. Capture what the run actually did; pin it as tomorrow’s test.

v1 limits (honest by construction): single-op tapes only; Int and Text args/results only (the tape stores Erlang inspect reprs, and only those two shapes round-trip into surface literals). Multi-op sequences need a cursor — future work.

Values

pub fn ability_name_for_key(
  key: String,
) -> Result(String, String)

The tape stores the ability’s module key (m_), not its surface name. Map back through the bootstrap ability table; an ability outside it is an honest error, never a guess.

pub fn command(args: List(String)) -> Nil
pub fn generate(
  subject_path: String,
  def_name: String,
  tape_json: String,
) -> Result(String, String)

Generate the regression test source. Reads the subject file (defs are restated verbatim so the generated file stands alone), parses the tape, and emits mock + test defs.

pub fn repr_to_literal(repr: String) -> Result(String, String)

Erlang inspect repr → gleamunison surface literal. v1 grammar: text (<<"hi">> → "hi"), integers, and lists of the same. Anything else is an honest error, never a guess.

✨ Search Document