https://github.com/evandrolg/simple_test
:ok_hand: A powerful, minimalist and easy-to-use Lua unit testing framework.
https://github.com/evandrolg/simple_test
lua testing
Last synced: 6 months ago
JSON representation
:ok_hand: A powerful, minimalist and easy-to-use Lua unit testing framework.
- Host: GitHub
- URL: https://github.com/evandrolg/simple_test
- Owner: EvandroLG
- License: mit
- Created: 2017-06-16T03:22:16.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2023-12-22T20:51:15.000Z (about 2 years ago)
- Last Synced: 2025-04-13T20:16:03.291Z (10 months ago)
- Topics: lua, testing
- Language: Lua
- Homepage:
- Size: 38.1 KB
- Stars: 24
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# simple_test
A powerful, minimalist and easy-to-use Lua unit testing framework.
[](https://travis-ci.org/EvandroLG/simple_test)
## Installation
To install `simple_test`, simply run:
```sh
$ luarocks install simple_test
```
Or copy the `simple_test.lua` file and paste in your project :)
## Getting started
A minimal test setup:
```lua
local test = require 'simple_test'
test('assert.equal', function(a)
a.ok(1 == 1, 'passed!')
end)
```
## asserts
* assert.ok(test, [failure_message])
Checks if `test` is true.
* assert.not_ok(test, [failure_message])
Checks if `test` is false.
* assert.equal(actual, expected, [failure_message])
Tests if `actual` is equal `expected`.
* assert.not_equal(actual, expected, [failure_message])
Checks if `actual` is not equal `expected`.
* assert.throw(function, params, [raised_message], [failure_message])
Checks if a `function` throws an exception and optionally compare the throw error.
* assert.delta(actual_float, expected_float, [delta], [failure_message])
Checks if `actual_float` and `expected_float` are equal within optional `delta` tolerance
* assert.deep_equal(actual, expected, [failure_message])
Tests for deep equality between the `actual` and `expected` parameters.
## Author
|[](https://github.com/evandrolg)|
|:---:|
|[@evandrolg](http://www.github.com/evandrolg)|