Game Development Reference
In-Depth Information
assert.falsy(nil)
assert.error(function() error("Wat") end)
end)
it("should provide some shortcuts to common functions", function()
assert.unique({{ thing = 1 }, { thing = 2 }, { thing = 3 }})
end)
it("should have mocks and spies for functional tests", function()
local thing = require("thing_module")
spy.spy_on(thing, "greet")
thing.greet("Hi!")
assert.spy(thing.greet).was.called()
assert.spy(thing.greet).was.called_with("Hi!")
end)
end)
URL : https://github.com/Yonaba/Moses/
Price : Free
Platforms : All Lua-based platforms
The Moses library, created by Roland Yonaba, helps manage tables in Lua, and includes functionality
for popping and pushing, slicing, returning the first item, and returning the next item. Moses doesn't
have any dependencies on other functions or classes, and can be used across frameworks.
Sample Code
local moses = require("moses")
local list = moses.range(10)
-- => {0,1,2,3,4,5,6,7,8,9,10}
list = moses.map(list, function(_,value) return value*10+value end)
-- => {0,11,22,33,44,55,66,77,88,99,110}
list = moses.filter(list,function(i,value) return value%2==0 end)
-- => {0,22,44,66,88,110}
moses.each(list,print)
-- => 1 0
-- => 2 22
-- => 3 44
-- => 4 66
-- => 5 88
-- => 6 110
 
Search WWH ::




Custom Search