tests
Tests are test("name") { … } blocks run by coil test; see Tests. assert! raises an error rather than panicking, so it works in any function that returns a Result.
Part of coil-stdlib. spool projects get it automatically; with plain coil, pass --root ~/.coil/stdlib/src.
Import what you use (use path::* is not allowed):
use tests::{not, eq};
Macros#
| Name | Description |
|---|---|
not! | Expands to !expression. |
eq! | Expands to lhs == rhs. |
matches! | Returns whether expr matches the pattern ty, as a bool. |
type! | Expands to typeof ty: the type of an expression, as a value that can be compared. |
and! | Expands to lhs && rhs. |
assert! | Fails the enclosing function with an error when condition is false. |