simple_test
A powerful, minimalist and easy-to-use Lua unit testing framework.
Installation
To install simple_test
, simply run:
$ luarocks install simple_test
Or copy the simple_test.lua
file and paste in your project :)
Getting started
A minimal test setup:
local test = require 'simple_test'
test('assert.equal', function(a)
a.ok(1 == 1, 'passed!')
end)
asserts
-
assert.
ok(test, [failure_message])
Checks iftest
is true. -
assert.
not_ok(test, [failure_message])
Checks iftest
is false. -
assert.
equal(actual, expected, [failure_message])
Tests ifactual
is equalexpected
. -
assert.
not_equal(actual, expected, [failure_message])
Checks ifactual
is not equalexpected
. -
assert.
throw(function, params, [raised_message], [failure_message])
Checks if afunction
throws an exception and optionally compare the throw error. -
assert.
delta(actual_float, expected_float, [delta], [failure_message])
Checks ifactual_float
andexpected_float
are equal within optionaldelta
tolerance -
assert.
deep_equal(actual, expected, [failure_message])
Tests for deep equality between theactual
andexpected
parameters.
Author
@evandrolg |