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()
Just copy all files to Lua's path. A rockspec file to be used with LuaRocks will be provided soon.
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.
I plan to provide some kind of output compatible with Jenkins. Also, no stack traces are recorded when an assertion fails, yet.
I'd like to acknowledge the work of the following people:
Siteswap is available under the MIT license.