testing

.zn module

Minimal test framework. import "testing". Failed assertions don't abort — all run, then a summary prints. ---

testing.new_suite(name: string) => Suite

Create a suite.

testing.assert_true(t, condition: bool, label: string)

Assert truthy.

testing.assert_false(t, condition: bool, label: string)

Assert falsy.

testing.assert_eq(t, got, expected, label: string)

Assert equal (deep value equality via ==).

testing.assert_ne(t, got, expected, label: string)

Assert not equal.

testing.assert_contains(t, haystack, needle: string, label: string)

Assert substring.

testing.run(t) => bool

Print the summary; returns true if all passed.

import "testing"
t := testing.new_suite("math tests")
testing.assert_eq(t, 1 + 1, 2, "basic addition")
testing.assert_true(t, 5 > 3, "comparison")
testing.run(t)
On this page