Test
Test module: lightweight assertion helpers for in-process testing.
Tests are plain March functions; a test passes if it returns without calling panic/fail. Use these helpers to make assertions.
Functions
Assert two values are structurally equal (generic).
Uses March's built-in structural equality (the `==` operator), so this
works on any types that aren't functions or opaque resources — ints,
strings, booleans, floats, tuples, records, ADT variants, lists, and
combinations of them.
On failure, both values are rendered via `to_string` (same form as
`inspect`/`debug`) and included in the panic message so failures
are easy to diagnose.
Example:
Test.assert_eq((1, "a"), (1, "a"), "tuple equal")
Test.assert_eq([1, 2, 3], [1, 2, 3], "list equal")
Test.assert_eq(Some(42), Some(42), "option equal")Assert two booleans are equal.
Assert two ints are equal.
Assert two strings are equal.
Assert a Result is Err and return the error value.
Assert that cond is false; panic with msg if not.
Assert two values are not structurally equal.
Counterpart to `assert_eq`; panics if the values compare equal via `==`.
Useful for checking that mutation/update paths actually changed something.Assert an Option is None.
Assert a Result is Ok and return the inner value.
Assert an Option is Some and return the inner value.
Assert that cond is true; panic with msg if not.
Fail immediately with a descriptive message.