2015-03-26 09:54:28 +00:00
|
|
|
--
|
|
|
|
-- tests/base/test_module_loader.lua
|
|
|
|
-- Test the custom module loader.
|
|
|
|
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
|
|
|
--
|
|
|
|
|
2017-04-25 05:44:13 +00:00
|
|
|
local p = premake
|
2015-03-26 09:54:28 +00:00
|
|
|
local suite = test.declare("module_loader")
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup
|
|
|
|
--
|
|
|
|
|
|
|
|
local loaderIndex
|
|
|
|
|
|
|
|
function suite.setup()
|
2016-03-02 00:09:40 +00:00
|
|
|
table.insert(package.searchers, function (name)
|
2017-04-25 05:44:13 +00:00
|
|
|
p.out(name)
|
2016-03-02 00:09:40 +00:00
|
|
|
return load("")
|
2015-03-26 09:54:28 +00:00
|
|
|
end)
|
2016-03-02 00:09:40 +00:00
|
|
|
loaderIndex = #package.searchers
|
2015-03-26 09:54:28 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.teardown()
|
2016-03-02 00:09:40 +00:00
|
|
|
table.remove(package.searchers, loaderIndex)
|
2015-03-26 09:54:28 +00:00
|
|
|
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
|