Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions Tests/Ix/Tc/Roundtrip.lean
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,17 @@ def fixtureTests : TestSeq := Id.run do
("shared subterms", envShare.1),
("mutual defs block", envMutualDefs.1),
("inductive block", envInductive.1) ]
/- Defer a pure computation until the returned IO action is executed.
A plain `pure (f ())` is strict enough for Lean to run `f` while the
surrounding `TestSeq` is constructed. -/
let deferIO := fun f s => .ok (f ()) s
let mut ts : TestSeq := .done
for (label, env) in cases do
let (rows, err?) := roundtripAll env
let msg := match err? with | some e => s!" — {e}" | none => ""
ts := ts ++ test s!"roundtrip fixture: {label} ({rows} rows){msg}" err?.isNone
let testIO := deferIO fun () =>
let (rows, err?) := roundtripAll env
let msg := err?.map fun e => s!"{rows} rows — {e}"
(err?.isNone, 0, 1, msg)
ts := ts ++ .individualIO s!"roundtrip fixture: {label}" none testIO .done
return ts

open Tests.Tc.Fixtures in
Expand Down
Loading