Software /
code /
prosody
Comparison
tests/test.lua @ 1963:7533549e8ba6
tests: Have fake module() set _M to satisfy some modules
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Fri, 16 Oct 2009 22:30:59 +0100 |
parent | 1961:3652ef68c361 |
child | 1972:26d4b99ba211 |
comparison
equal
deleted
inserted
replaced
1962:3e7231c6d6a9 | 1963:7533549e8ba6 |
---|---|
117 if not success then | 117 if not success then |
118 print("WARNING: ", "Failed to initialise tests for "..unitname, err); | 118 print("WARNING: ", "Failed to initialise tests for "..unitname, err); |
119 return; | 119 return; |
120 end | 120 end |
121 | 121 |
122 local unit = setmetatable({}, { __index = setmetatable({ module = function () end }, { __index = _G }) }); | 122 local unit = setmetatable({}, { __index = setmetatable({ module = function () _M = getfenv(2); end }, { __index = _G }) }); |
123 | 123 |
124 local fn = "../"..unitname:gsub("%.", "/")..".lua"; | 124 local fn = "../"..unitname:gsub("%.", "/")..".lua"; |
125 local chunk, err = loadfile(fn); | 125 local chunk, err = loadfile(fn); |
126 if not chunk then | 126 if not chunk then |
127 print("WARNING: ", "Failed to load module: "..unitname, err); | 127 print("WARNING: ", "Failed to load module: "..unitname, err); |