diff options
author | Matthew Wild <mwild1@gmail.com> | 2013-06-29 14:45:47 +0100 |
---|---|---|
committer | Matthew Wild <mwild1@gmail.com> | 2013-06-29 14:45:47 +0100 |
commit | 1ff17bd2f363d64e96b5f55c40da0768eb2931a0 (patch) | |
tree | 27741db74d498be76001287c8a4e6a9076bb5a27 /tests/test.lua | |
parent | d9d3fda27d4cbd522bbf2b53bb22c7659020a0c7 (diff) | |
parent | 237fbdb8e53b39063c1df36d94f59695d80c2de2 (diff) | |
download | prosody-1ff17bd2f363d64e96b5f55c40da0768eb2931a0.tar.gz prosody-1ff17bd2f363d64e96b5f55c40da0768eb2931a0.zip |
Merge
Diffstat (limited to 'tests/test.lua')
-rw-r--r-- | tests/test.lua | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tests/test.lua b/tests/test.lua index db727ce1..b6728061 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -12,12 +12,12 @@ function run_all_tests() 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 @@ function dotest(unitname) 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 |