Renderingen-US

setup

Translation status: English reader-locale proof. Term names and code fences follow the en pack; supporting prose may still be English.

Registers a before-each test hook.

Syntax: setup <block>

Category#

testing

Examples#

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

Registers a before-each test hook.

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

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

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