渲染zh-Hans

测试

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans pack; supporting prose may still be English.

Defines a single test case.

Aliases: test, it

Syntax: 测试 <name> [modifiers] <block>

Category#

testing

Examples#

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

Defines a single test case.

# =============================================================================
# 测试 — Defines a single test case.
# =============================================================================
#
# What this teaches:
#   • Individual test cases — `测试` declares one test with a descriptive name
#     and optional modifiers
#   • Tests live inside `验题` suites and contain `断言` assertions
#
# Common mistakes:
#   • Using `断言` outside a `测试`/`验题` test block — `断言` is deprecated in production code (WARN006).
#
# See also: 验题, 断言, 跳过, 预期
# =============================================================================

# 测试 — single test case
#
# GRAMMAR:
#   testDecl :← '测试' stringLit block
#
# EXPECTED OUTPUT:
#   No 入口 — declaration or test-runner surface only.
#
# BACKEND:
#   declaration-only test case (whitelist: 测试/proba.fab). Cross-ref: 验题/probandum.fab.
#

test "arithmetic passes" 标签 "math" {
    assert 1 + 1 ≡ 2
}