เตรียม
Translation status: ภาษาไทย reader-locale proof. Term names and code fences follow the th-TH pack; supporting prose may still be English.
Registers a before-each test hook.
Syntax: เตรียม <block>
Category#
testing
Related#
Examples#
radix/corpus/praepara/praepara.fab (canonical · keyword)#
Registers a before-each test hook.
# =============================================================================
# เตรียม — Registers a before-each test hook.
# =============================================================================
#
# What this teaches:
# • Testing setup hooks — `เตรียม` registers a block that runs before each
# test case (`ทดสอบ`) in the suite, ensuring shared state or side effects
# are prepared
# • Works with `หลังเตรียม` (after-each) for paired setup/teardown
#
# Common mistakes:
# • Confusing `เตรียม` (setup) with `หลังเตรียม` (teardown) — they run at opposite ends of each test.
#
# See also: หลังเตรียม, ทั้งหมด
# =============================================================================
# เตรียม — before-each test hook
#
# GRAMMAR:
# hookDecl :← 'เตรียม' block
#
# EXPECTED OUTPUT:
# No เริ่ม — declaration or test-runner surface only.
#
# BACKEND:
# declaration-only test hook (whitelist: เตรียม/praepara.fab).
#
describe "hooks" {
setup {
print "before each"
}
test "sample" {
assert true
}
}