渲染zh-Hant

後置準備

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