legion-test

Testing framework for legionhjyu programs. Write unit tests, assertions, and test suites with built-in runner and colored output.

v2.0.1 MIT @legionhjyu Updated NaNy ago
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 test

test.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

FunctionDescription
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