Merged in dcourtois/premake-dev/issue_265 (pull request #159)
fixed issue #265
This commit is contained in:
commit
2c8facae20
@ -57,10 +57,6 @@
|
||||
end
|
||||
|
||||
local chunk, err = loadfile(p)
|
||||
if not chunk then
|
||||
error(err, 0)
|
||||
end
|
||||
|
||||
return chunk
|
||||
end
|
||||
|
||||
|
@ -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",
|
||||
|
37
tests/base/test_module_loader.lua
Normal file
37
tests/base/test_module_loader.lua
Normal 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
|
Reference in New Issue
Block a user