SiteSwap, a simple asynchronous test framework based on lunit.
Lua
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lua/siteswap
rockspecs
LICENSE
README.md

README.md

siteswap

Siteswap is a simple asynchronous test framework for LuaNode, based on lunit.

Siteswap is...

a notation used to describe juggling patterns..

(taken from Wikipedia).

Writing tests for asynchronous code is mostly juggling stuff in the air, so...

What does it look like?

Since it is based on lunit, Siteswap tests look very similar.

local Runner = require "siteswap.runner"
local Test = require "siteswap.test"
local runner = Runner()

runner:AddTest("equality", function(test)
  test:assert_equal(12345, 12345)
  test:Done()
end)

runner:AddTest("FOO", function(test)
  setTimeout(function()
    test:assert_equal("hello", "hello")
  end, 1000)
  
  setTimeout(test:Last(function()
    console.log("something will happen in two seconds")
  end), 2000)
end)

runner:Run()

process:loop()

Installation

Just copy all files to Lua's path. A rockspec file to be used with LuaRocks will be provided soon.

Documentation

Until I write some proper documentation you can take a look at redis-luanode tests as a guide. In fact, Siteswap was written in order to test it.

Status

I plan to provide some kind of output compatible with Jenkins. Also, no stack traces are recorded when an assertion fails, yet.

Acknowledgments

I'd like to acknowledge the work of the following people:

License

Siteswap is available under the MIT license.