tests: Have fake module() set _M to satisfy some modules
authorMatthew Wild <mwild1@gmail.com>
Fri, 16 Oct 2009 21:30:59 +0000 (22:30 +0100)
committerMatthew Wild <mwild1@gmail.com>
Fri, 16 Oct 2009 21:30:59 +0000 (22:30 +0100)
tests/test.lua

index 0cec6cbaa9f7cd1aaa03f0b329792db26ec2c608..4f41cd1db369397cf19834e6fa9b893b10106c23 100644 (file)
@@ -119,7 +119,7 @@ function dotest(unitname)
                return;
        end
        
-       local unit = setmetatable({}, { __index = setmetatable({ module = function () end }, { __index = _G }) });
+       local unit = setmetatable({}, { __index = setmetatable({ module = function () _M = getfenv(2); end }, { __index = _G }) });
 
        local fn = "../"..unitname:gsub("%.", "/")..".lua";
        local chunk, err = loadfile(fn);