渲染zh-Hans

备置

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans 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
    }
}