渲染zh-Hant

測試規格

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

Groups related test cases into a named suite.

Aliases: describe, suite

Syntax: 測試規格 <name> [modifiers] <block>

Category#

testing

Examples#

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

Groups related test cases into a named suite.

# =============================================================================
# 測試規格 — Groups related test cases into a named suite.
# =============================================================================
#
# What this teaches:
#   • Test suite grouping — `測試規格` organizes related `測試` test cases
#     under a descriptive name
#   • Suites can be nested to create hierarchical test organization
#
# Common mistakes:
#   • Placing `測試` outside a `測試規格` suite, or forgetting a `tag` modifier on the test case.
#
# See also: 測試, 斷言
# =============================================================================

# 測試規格 / 測試 — declaration-only test suites
#
# 測試規格 "name" { 測試 "case" { 斷言 expr } … }   -- test group
# 測試規格 "nested" { 測試規格 "inner" { … } }         -- nested suite
#
# GRAMMAR:
#   probandumDecl :← '測試規格' stringLit block
#   probaDecl     :← '測試' stringLit block
#
# EXPECTED OUTPUT:
#   No stdout — 斷言 cases produce no 註記 output when run as tests.
#
# BACKEND: No 入口 block — test-runner surface; exempla e2e whitelists as
# declaration-only (whitelist: 測試規格/probandum.fab).

describe "arithmetica" {
    test "unum plus unum" {
        assert 1 + 1 ≡ 2
    }

    test "multiplicatio" {
        assert 3 * 4 ≡ 12
    }

    describe "implicata" {
        test "comparatio" {
            const _ x ← 10
            assert x ≥ 10
        }
    }
}