From 8178f7bd884410b53329d6fc0b9c49891081a91d Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Wed, 6 Jan 2016 00:24:06 +0000 Subject: tests/test.lua: Fix fake module() function to prevent _M from being _G (test.lua's environment), which caused modules to break the sandbox when they set _M.* --- tests/test.lua | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'tests') diff --git a/tests/test.lua b/tests/test.lua index de1e40fd..bb11ab26 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -137,7 +137,10 @@ function dotest(unitname) end local oldmodule, old_M = _fakeG.module, _fakeG._M; - _fakeG.module = function () _M = _G end + _fakeG.module = function () + setmetatable(unit, nil); + unit._M = unit; + end setfenv(chunk, unit); local success, err = pcall(chunk); _fakeG.module, _fakeG._M = oldmodule, old_M; -- cgit v1.2.3 From b3d9c810676d288d193e4dcc3d95456e8a050f0e Mon Sep 17 00:00:00 2001 From: Kim Alvefur Date: Fri, 8 Jan 2016 16:20:02 +0100 Subject: tests: Fix merge, modulemanager test was removed --- tests/test.lua | 1 - 1 file changed, 1 deletion(-) (limited to 'tests') diff --git a/tests/test.lua b/tests/test.lua index 5d5851e1..1192b7b8 100644 --- a/tests/test.lua +++ b/tests/test.lua @@ -14,7 +14,6 @@ function run_all_tests() dotest "util.multitable" dotest "util.rfc6724" dotest "util.http" - dotest "core.modulemanager" dotest "core.stanza_router" dotest "core.s2smanager" dotest "core.configmanager" -- cgit v1.2.3