12. test blocks and dawn fmt
test "name" { ... } holds assertions written with assert; dawn test runs them, and
dawn build strips them out. A test for a pure function needs no mocks at all:
fn add(a: Int, b: Int) -> Int = a + b
test "addition commutes" {
assert add(2, 3) == add(3, 2)
assert add(0, 5) == 5
}
pub fn main() -> Unit !io = println("ok")
Open in playground
ok
And finally: dawn fmt settles the code style (2-space indent, regular spacing), and
dawn fmt --check is the form CI wants. Get into the habit of running dawn fmt before
you commit, and code review never has to argue about whitespace again.