tests: Fix merge, modulemanager test was removed
[prosody.git] / tests / test.lua
index 1666fcf5199e8de327b05db19cb78162e03e6bff..1192b7b83a659f4a2987dd50e7a194d19f6abbd7 100644 (file)
@@ -140,9 +140,12 @@ function dotest(unitname)
        end
 
        local oldmodule, old_M = _fakeG.module, _fakeG._M;
-       _fakeG.module = function () _M = unit end
+       _fakeG.module = function ()
+               setmetatable(unit, nil);
+               unit._M = unit;
+       end
        setfenv(chunk, unit);
-       local success, ret = pcall(chunk);
+       local success, err = pcall(chunk);
        _fakeG.module, _fakeG._M = oldmodule, old_M;
        if not success then
                print("WARNING: ", "Failed to initialise module: "..unitname, err);