Install
legion pkg install legion-test
legion-test
Testing framework for legionhjyu. Write clean, readable tests with zero configuration.
Install
legion pkg install legion-test
Usage
summon "legion-test" release testtest.suite("Math functions") {
test.it("adds two numbers") {
test.eq(add(2, 3), 5)
}
test.it("handles negative numbers") {
test.eq(add(-1, 1), 0)
}
}
test.run()
Assertions
| Function | Description |
|---|---|
test.eq(a, b) | Assert a equals b |
test.neq(a, b) | Assert a does not equal b |
test.ok(expr) | Assert expression is truthy |
test.fail(msg) | Force test failure |
test.throws(fn) | Assert fn throws an error |
test.near(a, b, delta) | Assert floats approximately equal |