Software /
code /
prosody
Diff
tests/test.lua @ 5604:6df0ec991f2e
tests: Some much-needed cleanup...
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 18 May 2013 17:14:30 +0100 |
parent | 4420:4314eeeed394 |
child | 5776:bd0ff8ae98a8 |
line wrap: on
line diff
--- a/tests/test.lua Sat May 18 16:45:29 2013 +0100 +++ b/tests/test.lua Sat May 18 17:14:30 2013 +0100 @@ -12,12 +12,12 @@ package.loaded["net.connlisteners"] = { get = function () return {} end }; dotest "util.jid" dotest "util.multitable" - dotest "util.rfc3484" - dotest "net.http" - dotest "core.modulemanager" + dotest "util.rfc6724" + dotest "util.http" dotest "core.stanza_router" dotest "core.s2smanager" dotest "core.configmanager" + dotest "util.ip" dotest "util.stanza" dotest "util.sasl.scram" @@ -136,15 +136,21 @@ end local oldmodule, old_M = _fakeG.module, _fakeG._M; - _fakeG.module = function () _M = _G end + _fakeG.module = function () _M = unit end setfenv(chunk, unit); - local success, err = pcall(chunk); + local success, ret = pcall(chunk); _fakeG.module, _fakeG._M = oldmodule, old_M; if not success then print("WARNING: ", "Failed to initialise module: "..unitname, err); return; end + if type(ret) == "table" then + for k,v in pairs(ret) do + unit[k] = v; + end + end + for name, f in pairs(unit) do local test = rawget(tests, name); if type(f) ~= "function" then