> module
std::assert
test assertions
use std::assert; in the browser
std::assert provides assertion functions for testing. A failed assertion stops the program with a runtime error that starts assertion failed.
Equality is value equality. A fieldless #[repr] enum variant also equals its integer value.
> functions
#
fail(message?: any)Always fails, with message in the error if given. It may be any value.
#
is_eq(left: T, right: T)Assert that left equals right, showing both values if not.
#
is_false(value: bool)Assert that value is false.
#
is_ne(left: T, right: T)Assert that left does not equal right.
#
is_true(value: bool)Assert that value is true.
> examples
use std::assert;
fn main() {
assert::is_eq(1 + 1, 2);
assert::is_ne("hello", "world");
assert::is_true(10 > 5);
}