luaunit
luaunit copied to clipboard
Local test groups and their order of execution.
Static analysis using Luacheck for such a set of tests:
local lu = require "luaunit";
TestFirst = {};
function TestFirst:test_01()
--
end;
TestOther = {};
-- ...
os.exit(lu.LuaUnit.run());
Shows:
FunctionsTest.lua:3:1: setting non-standard global variable TestFirst
FunctionsTest.lua:5:10: mutating non-standard global variable TestFirst
FunctionsTest.lua:5:19: unused argument self
I would expect an alternative approach:
local lu = require "luaunit";
local TestFirst = {};
function TestFirst:test_01()
-- ...
end;
local TestOther = {};
-- ...
os.exit(lu.LuaUnit.run({TestFirst, TestOther}));
This approach will not generate these warnings, making it easier to analyze the content of the test, and it would also make it easier to determine the order of tests at the group level.