Renderingen-US

expect_failure

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

Marks a test as expected to fail.

Aliases: expect failure

Syntax: test <name> expect_failure <block>

Category#

testing

Examples#

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

Marks a test as expected to fail.

# =============================================================================
# expect_failure — Marks a test as expected to fail
# =============================================================================
#
# What this teaches:
#   • Expected failure — `expect_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 `skip` and `flaky`.
#
# Common mistakes:
#   • Confusing expect_failure (expected failure) with skip (skipped) — an expect_failure test still runs.
#
# See also: test, flaky, skip
# =============================================================================

# expect_failure — expected-failure test modifier
#
# GRAMMAR:
#   testModifier :← 'expect_failure'
#
# EXPECTED OUTPUT:
#   expect_failure declared

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

main {
    print "erratur declared"
}

Expected output:

erratur declared