渲染zh-Hant

準備

Translation status: 繁體中文 reader-locale proof. Term names and code fences follow the zh-Hant pack; supporting prose may still be English.

Registers a before-each test hook.

Syntax: 準備 <block>

Category#

testing

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
    }
}