std/test

Types

Failure

pub type Failure = {
    pub text String
}

Error raised by fail test.failure(...) inside a test block.

Failure.message

pub fn Failure.message(self) -> String

The failure text.

Functions

failure

pub pure fn failure(text: String) -> Failure

Creates a test failure carrying text.

expectEq

pub pure fn expectEq[T: Eq](actual: T, expected: T) -> Void!

Fails with expected <expected>, got <actual> unless the two are equal.

expectEqRef

pub pure fn expectEqRef[T: Eq](actual: &T, expected: &T) -> Void!

Same as expectEq but borrows both values, so a record or an Array can be compared again afterwards.

assert

pub pure fn assert(condition: Bool, message: String)

Stops the program with message unless condition holds. Prefer expectEq or fail where the caller can handle the failure.