渲染zh-Hans

预期失败

Translation status: 简体中文 reader-locale proof. Term names and code fences follow the zh-Hans 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