渲染zh-Hans

收尾

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

Registers an after-each test hook.

Syntax: 收尾 <block>

Category#

testing

Examples#

radix/corpus/postpara/postpara.fab (canonical · keyword)#

Registers an after-each test hook.

# =============================================================================
# 收尾 — Registers an after-each test hook.
# =============================================================================
#
# What this teaches:
#   • Test hooks — `收尾` registers cleanup logic that runs after every test case in a `验题` block.
#   • Teardown guarantee — The hook runs regardless of whether the test passes or fails.
#
# Common mistakes:
#   • Confusing `收尾` (teardown) with `备置` (setup) — they run at opposite ends of each test.
#
# See also: 备置, 全部
# =============================================================================

# 收尾 — after-each test hook
#
# GRAMMAR:
#   hookDecl :← '收尾' block
#
# EXPECTED OUTPUT:
#   No 入口 — declaration or test-runner surface only.
#
# BACKEND:
#   declaration-only test hook (whitelist: 收尾/postpara.fab).
#

describe "hooks" {
    teardown {
        print "after each"
    }
    test "sample" {
        assert true
    }
}