OxL Справочник OxL
РусскийEnglish

fn assert_fails

Test helper (§18.2): passes when x is an error of type E, i.e. assert_fails(parse(text), ParseError); otherwise the test fails and shows the value. x is a value of a union type that has E as a member (the call is written with the error type as a second argument, which the compiler turns into the generic argument E).

Example:

oxl✓ проверяется в CI
use std.core { ParseError }

test "parse rejects text" {
  assert_fails("x".parseInt(), ParseError)
}
@intrinsic("test.assertFails") pub(api) fn assert_fails<E, T>(x: T)

С версии. 1.0.0-beta

Параметры

ИмяТип
xT

Эффекты

не объявлены (чистая, пока тело не говорит иное)

Определено в: std/core/functions.oxl:148

См. также