渲染zh-Hant

預期失敗

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

Marks a test as expected to fail.

Aliases: expect failure

Syntax: 測試 <name> 預期失敗 <block>

Category#

testing

Examples#

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

Marks a test as expected to fail.

# =============================================================================
# 預期失敗 — Marks a test as expected to fail
# =============================================================================
#
# What this teaches:
#   • Expected failure — `預期失敗` records a test whose failing assertion is a known defect, with no argument.
#   • Modifier position — it sits between the test name and the body, like `略過` and `脆弱`.
#
# Common mistakes:
#   • Confusing 預期失敗 (expected failure) with 略過 (skipped) — an 預期失敗 test still runs.
#
# See also: 測試, 脆弱, 略過
# =============================================================================

# 預期失敗 — expected-failure test modifier
#
# GRAMMAR:
#   testModifier :← '預期失敗'
#
# EXPECTED OUTPUT:
#   預期失敗 declared

test "known defect" expect_failure {
    assert 1 + 1 ≡ 3
}

main {
    print "erratur declared"
}

Expected output:

erratur declared