/simple_test

:ok_hand: A powerful, minimalist and easy-to-use Lua unit testing framework.

Primary LanguageLuaMIT LicenseMIT

simple_test

A powerful, minimalist and easy-to-use Lua unit testing framework.

Build Status

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

@evandrolg
@evandrolg