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
commite491b17e6f0187c419ac9a4d7178d9b1b9ac88be (patch)
treef39ac325409c6e76318d8a769f8217332e16f1d1 /tests/test.lua
parent62a1d8a2d312c61673f868878efdcb747c63f772 (diff)
downloadprosody-e491b17e6f0187c419ac9a4d7178d9b1b9ac88be.tar.gz
prosody-e491b17e6f0187c419ac9a4d7178d9b1b9ac88be.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