Language
Testing
Write `test` blocks in Tea and run them with `tea test`. Assertions live in `std.assert`.
Tea tests live in ordinary Tea files. Define test blocks, import assertion helpers from std.assert, and run everything through tea test.
Write a test block
A test block gives a named test case a small body of executable Tea code. Inside it, use assertion helpers to check expectations and fail fast when behavior changes.
use assert from "std.assert"
test "list length stays stable"
var words = ["tea", "lang"]
assert.ok(@len(words) == 2)
assert.eq(words[0], "tea")
assert.ne(words[1], "chai")
endAssertion helpers
The standard assertion module covers the common cases: truthy checks, equality checks, inequality checks, and snapshot helpers when you want to compare output against stored expectations.
use assert from "std.assert"
test "basic assertions"
assert.ok(1 + 1 == 2)
assert.eq("tea", "tea")
assert.ne("tea", "chai")
endRun tests
Run the whole test suite or target a narrower path. The CLI can also list discovered tests or filter down to a subset when you only want to rerun one area.
tea test
tea test tests/
tea test --list
tea test --filter strings
tea test --update-snapshotsCurrent test surface
std.assertexportsok,eq,ne, andsnapshot.- The CLI discovers Tea
testblocks from paths you pass in. Snapshot support exists in the stdlib and CLI surface, but backend support is still uneven.