premake/tests/base/test_module_loader.lua

39 lines
666 B
Lua
Raw Normal View History

--
-- 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
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("")
end)
2016-03-02 00:09:40 +00:00
loaderIndex = #package.searchers
end
function suite.teardown()
2016-03-02 00:09:40 +00:00
table.remove(package.searchers, 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