aboutsummaryrefslogtreecommitdiffstats
path: root/tests/test.lua
diff options
context:
space:
mode:
authorMatthew Wild <mwild1@gmail.com>2013-05-18 17:14:30 +0100
committerMatthew Wild <mwild1@gmail.com>2013-05-18 17:14:30 +0100
commita0210694a542dceabf16ac2de14828eb2f7cd8f1 (patch)
treef39ac325409c6e76318d8a769f8217332e16f1d1 /tests/test.lua
parent38abedd4387beda9e443ad25f1b7d478a1a92520 (diff)
downloadprosody-a0210694a542dceabf16ac2de14828eb2f7cd8f1.tar.gz
prosody-a0210694a542dceabf16ac2de14828eb2f7cd8f1.zip
tests: Some much-needed cleanup...
Diffstat (limited to 'tests/test.lua')
-rw-r--r--tests/test.lua16
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