渲染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 async after-each test hook.

Syntax: 异步收尾 <block>

Category#

testing

Examples#

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

Registers an async after-each test hook.

# =============================================================================
# 异步收尾 — Registers an async after-each test hook.
# =============================================================================
#
# What this teaches:
#   • Async test hooks — `异步收尾` registers an async cleanup hook that runs after each test case.
#   • Async counterpart — Pairs with `异步备置` (async before-each) and mirrors `收尾` (sync after-each).
#
# Common mistakes:
#   • Confusing `异步收尾` (async teardown) with `异步备置` (async setup) — they run at opposite ends of each test.
#
# See also: 收尾, 异步备置
# =============================================================================

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

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