teardown
Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.
Registers an after-each test hook.
Syntax: teardown <block>
Category#
testing
Related#
Examples#
radix/corpus/postpara/postpara.fab (canonical · keyword)#
Registers an after-each test hook.
# =============================================================================
# teardown — Registers an after-each test hook.
# =============================================================================
#
# What this teaches:
# • Test hooks — `teardown` registers cleanup logic that runs after every test case in a `describe` block.
# • Teardown guarantee — The hook runs regardless of whether the test passes or fails.
#
# Common mistakes:
# • Confusing `teardown` (teardown) with `setup` (setup) — they run at opposite ends of each test.
#
# See also: setup, all
# =============================================================================
# teardown — after-each test hook
#
# GRAMMAR:
# hookDecl :← 'teardown' block
#
# EXPECTED OUTPUT:
# No main — declaration or test-runner surface only.
#
# BACKEND:
# declaration-only test hook (whitelist: teardown/postpara.fab).
#
describe "hooks" {
teardown {
print "after each"
}
test "sample" {
assert true
}
}