Merged in dcourtois/premake-dev/issue_265 (pull request #159)

fixed issue #265
This commit is contained in:
Jason Perkins 2015-03-29 17:28:10 -04:00
commit 2c8facae20
3 changed files with 38 additions and 4 deletions

View File

@ -57,10 +57,6 @@
end
local chunk, err = loadfile(p)
if not chunk then
error(err, 0)
end
return chunk
end

View File

@ -6,6 +6,7 @@ return {
"base/test_criteria.lua",
"base/test_detoken.lua",
"base/test_include.lua",
"base/test_module_loader.lua",
"base/test_option.lua",
"base/test_os.lua",
"base/test_override.lua",

View File

@ -0,0 +1,37 @@
--
-- tests/base/test_module_loader.lua
-- Test the custom module loader.
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
--
local suite = test.declare("module_loader")
--
-- Setup
--
local loaderIndex
function suite.setup()
table.insert(package.loaders, function (name)
premake.out(name)
return loadstring("")
end)
loaderIndex = #package.loaders
end
function suite.teardown()
table.remove(package.loaders, loaderIndex)
end
--
-- Check that premake's module loader let other loaders try
-- when it cannot find a module.
--
function suite.letOtherLoadersTry()
require("foo")
test.capture [[
foo
]]
end