Module
poke/failure
src/poke/failure.pookaKeep a failure in a small, labelled box before deciding how to show it. Comparisons retain separate expected and actual text, formatted with the same plain printer used for snapshots. Capture observes exceptions in this process; it does not impose a deadline or undo the callback's effects.
API reference
enum Kind
Every assertion family has a stable category, without exposing BEAM terms.
Kind.Comparison
Kind.Assertion
Kind.Panic
Kind.Exception
class Failure(
kind: Kind,
message: String,
expected: Option(String),
actual: Option(String)
)
kind: Kind
INFERRED
poke/failure.Kindmessage: String
INFERRED
Stringexpected: Option(String)
INFERRED
Option(String)actual: Option(String)
INFERRED
Option(String)
INFERRED
fn(poke/failure.Kind, String, Option(String), Option(String)) -> poke/failure.Failurecapture(run: fn() -> a) -> Result(a, Failure)
INFERRED
fn(fn() -> a) -> Result(a, poke/failure.Failure)Observe an assertion, panic or foreign exception as structured data.
let problem = failure.capture(fn() { should.equal(1, 2) }) |> should.be_error()
should.equal(problem.expected, Some("2"))
compare(actual: a, expected: a, label: String) -> Result(Nil, Failure)
INFERRED
fn(a, a, String) -> Result(Nil, poke/failure.Failure)Build a comparison without raising, useful for custom assertion libraries.
describe(problem: Failure) -> String
INFERRED
fn(poke/failure.Failure) -> StringFormat one complete report. No terminal colours or presentation truncation.