渲染zh-Hans

praepara

Translation status: 简体中文 reader-locale proof. Code fences render through the zh-Hans pipeline; prose is canonical Latin.

Registers a before-each test hook.

Syntax: praepara <block>

Category#

testing

Examples#

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

Registers a before-each test hook.

# =============================================================================
# praepara — Registers a before-each test hook.
# =============================================================================
#
# What this teaches:
#   • Testing setup hooks — `praepara` registers a block that runs before each
#     test case (`proba`) in the suite, ensuring shared state or side effects
#     are prepared
#   • Works with `postpara` (after-each) for paired setup/teardown
#
# Common mistakes:
#   • Confusing `praepara` (setup) with `postpara` (teardown) — they run at opposite ends of each test.
#
# See also: postpara, omnia
# =============================================================================

# praepara — before-each test hook
#
# GRAMMAR:
#   hookDecl :← 'praepara' block
#
# EXPECTED OUTPUT:
#   No incipit — declaration or test-runner surface only.
#
# BACKEND:
#   declaration-only test hook (whitelist: praepara/praepara.fab).
#

describe "hooks" {
    setup {
        print "before each"
    }
    test "sample" {
        assert true
    }
}