Module

poke/should

src/poke/should.pooka

A 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.

Pooka
import poke/should

test "arithmetic keeps its promises" {
  should.equal(1 + 1, 2)
  should.equal(should.be_ok(Ok("owl")), "owl")
}

API reference

function

equal

src/poke/should.pooka:35
equal(actual: a, expected: a) -> Nil
INFERREDfn(a, a) -> Nil

Compare actual with expected using Pooka's exact equality. The native runner receives structured expected/got values and the calling test's location.

function

equal_named

src/poke/should.pooka:44
equal_named(actual: a, expected: a, label: String) -> Nil
INFERREDfn(a, a, String) -> Nil

A labelled comparison, useful when several examples share one test.

Pooka
should.equal_named(2 + 2, 4, "issue-12: adding two pairs")
function

not_equal

src/poke/should.pooka:49
not_equal(actual: a, unexpected: a) -> Nil
INFERREDfn(a, a) -> Nil

Reject an unexpected value.

function

be_true

src/poke/should.pooka:61
be_true(actual: Bool) -> Nil
INFERREDfn(Bool) -> Nil

Require True.

function

be_false

src/poke/should.pooka:66
be_false(actual: Bool) -> Nil
INFERREDfn(Bool) -> Nil

Require False.

function

be_ok

src/poke/should.pooka:71
be_ok(value: Result(a, e)) -> a
INFERREDfn(Result(a, b)) -> a

Open Ok or stop the test with the error still visible.

function

be_error

src/poke/should.pooka:79
be_error(value: Result(a, e)) -> e
INFERREDfn(Result(a, b)) -> b

Open Error or stop the test with the unexpected success visible.

function

be_some

src/poke/should.pooka:87
be_some(value: Option(a)) -> a
INFERREDfn(Option(a)) -> a

Open Some or stop the test.

function

be_none

src/poke/should.pooka:95
be_none(value: Option(a)) -> Nil
INFERREDfn(Option(a)) -> Nil

Require absence.

function

fail

src/poke/should.pooka:100
fail(message: String) -> a
INFERREDfn(String) -> a

Stop a test with an explanation.

function

inspect

src/poke/should.pooka:106
inspect(value: a) -> String
INFERREDfn(a) -> String

Inspect a Pooka value without printing it. Useful for counterexamples and explicit value snapshots; text snapshots should keep their text unchanged.

function

attempt

src/poke/should.pooka:113
attempt(run: fn() -> a) -> Result(a, String)
INFERREDfn(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.

function

contain

src/poke/should.pooka:121
contain(actual: List(a), expected: a) -> Nil
INFERREDfn(List(a), a) -> Nil

Require an item in a list, retaining the whole collection on failure.

function

contain_text

src/poke/should.pooka:133
contain_text(actual: String, expected: String) -> Nil
INFERREDfn(String, String) -> Nil

Require a literal substring, without treating it as a regular expression.

function

be_close

src/poke/should.pooka:145
be_close(actual: Float, expected: Float, tolerance: Float) -> Nil
INFERREDfn(Float, Float, Float) -> Nil

Compare finite floating-point values with an absolute tolerance.