Renderingen-US

async_setup

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

Registers an async before-each test hook.

Syntax: async_setup <block>

Category#

testing

Examples#

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

Registers an async before-each test hook.

# =============================================================================
# async_setup — Registers an async before-each test hook.
# =============================================================================
#
# What this teaches:
#   • Async test setup — `async_setup` registers an async block that runs before
#     each test case, used when setup involves I/O or future-based operations
#   • Async counterpart of `setup`; paired with `async_teardown` for async
#     setup/teardown
#
# Common mistakes:
#   • Confusing `async_setup` (async setup) with `async_teardown` (async teardown) — they run at opposite ends of each test.
#
# See also: setup, async_teardown
# =============================================================================

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

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