Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

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: about 2 months ago
JSON representation

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

Awesome Lists containing this project

README

        

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

[![Build
Status](https://travis-ci.org/EvandroLG/simple_test.svg?branch=master)](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
|[![@evandrolg](https://avatars3.githubusercontent.com/u/444054?v=3&s=96)](https://github.com/evandrolg)|
|:---:|
|[@evandrolg](http://www.github.com/evandrolg)|