Module
poke/should
src/poke/should.pookaA small lantern for things that should have worked.
Keep Pooka's own test declarations and runner. These helpers add labelled comparisons and unwrapping assertions; property and snapshot tests live in poke/property and poke/snapshot. Nothing installs a second runner.
import poke/should
test "arithmetic keeps its promises" {
should.equal(1 + 1, 2)
should.equal(should.be_ok(Ok("owl")), "owl")
}
API reference
equal(actual: a, expected: a) -> Nil
fn(a, a) -> NilCompare actual with expected using Pooka's exact equality. The native runner receives structured expected/got values and the calling test's location.
equal_named(actual: a, expected: a, label: String) -> Nil
fn(a, a, String) -> NilA labelled comparison, useful when several examples share one test.
should.equal_named(2 + 2, 4, "issue-12: adding two pairs")
not_equal(actual: a, unexpected: a) -> Nil
fn(a, a) -> NilReject an unexpected value.
be_true(actual: Bool) -> Nil
fn(Bool) -> NilRequire True.
be_false(actual: Bool) -> Nil
fn(Bool) -> NilRequire False.
be_ok(value: Result(a, e)) -> a
fn(Result(a, b)) -> aOpen Ok or stop the test with the error still visible.
be_error(value: Result(a, e)) -> e
fn(Result(a, b)) -> bOpen Error or stop the test with the unexpected success visible.
be_some(value: Option(a)) -> a
fn(Option(a)) -> aOpen Some or stop the test.
be_none(value: Option(a)) -> Nil
fn(Option(a)) -> NilRequire absence.
fail(message: String) -> a
fn(String) -> aStop a test with an explanation.
inspect(value: a) -> String
fn(a) -> StringInspect a Pooka value without printing it. Useful for counterexamples and explicit value snapshots; text snapshots should keep their text unchanged.
attempt(run: fn() -> a) -> Result(a, String)
fn(fn() -> a) -> Result(a, String)Observe a callback failure as data. Property checks use this to shrink both a False predicate and a thrown assertion. It runs in the caller's process; it does not impose a timeout or undo effects.
contain(actual: List(a), expected: a) -> Nil
fn(List(a), a) -> NilRequire an item in a list, retaining the whole collection on failure.
contain_text(actual: String, expected: String) -> Nil
fn(String, String) -> NilRequire a literal substring, without treating it as a regular expression.
be_close(actual: Float, expected: Float, tolerance: Float) -> Nil
fn(Float, Float, Float) -> NilCompare finite floating-point values with an absolute tolerance.