Assert

Static assertion methods for verifying test conditions.

xxml
Language::Test

Methods

MethodParametersReturnsDescription
isTruecondition: Bool&, message: String&NoneAssert condition is true
isFalsecondition: Bool&, message: String&NoneAssert condition is false
equalsexpected: Integer&, actual: Integer&, message: String&NoneAssert integers are equal
equalsStringexpected: String&, actual: String&, message: String&NoneAssert strings are equal
notNullmessage: String&NoneReserved for nullable types
failmessage: String&NoneExplicitly fail the test

Examples

Assertion Examples

xxml
// Boolean assertions
Run Assert::isTrue(result.greaterThan(Integer::Constructor(0)), String::Constructor("Result should be positive"));
Run Assert::isFalse(list.isEmpty(), String::Constructor("List should not be empty"));

// Equality assertions
Run Assert::equals(
    Integer::Constructor(42),
    calculator.compute(),
    String::Constructor("Computation result")
);

Run Assert::equalsString(
    String::Constructor("hello"),
    greeting.toLowerCase(),
    String::Constructor("Greeting should be lowercase")
);

See Also