https://github.com/moritree/lua-tinyt
A tiny unit testing library for Lua.
https://github.com/moritree/lua-tinyt
lua unit-testing
Last synced: 21 days ago
JSON representation
A tiny unit testing library for Lua.
- Host: GitHub
- URL: https://github.com/moritree/lua-tinyt
- Owner: moritree
- License: apache-2.0
- Created: 2024-12-30T20:18:29.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2025-01-12T01:53:36.000Z (10 months ago)
- Last Synced: 2025-01-23T03:33:42.534Z (10 months ago)
- Topics: lua, unit-testing
- Language: Lua
- Homepage:
- Size: 21.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
A short, sweet, simple unit test framework for Lua. Refer to `example.lua` for usage.
# Creating a test suite
Import the test script.
```Lua
local test = require('lunit').create()
```
Register tests with `test:test(name, fn)`. Write your test code in `fn`, and use `test:expect()` statements to make your assertions.
```Lua
test:test("True is true", function()
test:expect(true).is_true()
end)
test:test("Basic maths is real", function()
test:expect(2 + 2).to_eq(4)
)
```
Run your registered tests.
```Lua
test:run()
```