2011-12-04 19:47:59 +00:00
|
|
|
--
|
|
|
|
-- tests/base/test_include.lua
|
|
|
|
-- Test the include() function, for including external scripts
|
2013-03-12 22:18:47 +00:00
|
|
|
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
|
2011-12-04 19:47:59 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
|
2013-03-12 22:18:47 +00:00
|
|
|
local suite = test.declare("include")
|
|
|
|
|
2011-12-04 19:47:59 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup and teardown
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.teardown()
|
|
|
|
-- clear the list of included files after each run
|
|
|
|
io._includedFiles = { }
|
|
|
|
end
|
2013-03-12 22:18:47 +00:00
|
|
|
|
|
|
|
|
2011-12-04 19:47:59 +00:00
|
|
|
--
|
|
|
|
-- Tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.include_findsPremakeFile_onFolderNameOnly()
|
|
|
|
include "folder"
|
2014-02-08 15:44:57 +00:00
|
|
|
test.isequal("ok", premake.captured())
|
2011-12-04 19:47:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.include_onExactFilename()
|
|
|
|
include "folder/premake4.lua"
|
2014-02-08 15:44:57 +00:00
|
|
|
test.isequal("ok", premake.captured())
|
2011-12-04 19:47:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.include_runsOnlyOnce_onMultipleIncludes()
|
|
|
|
include "folder/premake4.lua"
|
|
|
|
include "folder/premake4.lua"
|
2014-02-08 15:44:57 +00:00
|
|
|
test.isequal("ok", premake.captured())
|
2011-12-04 19:47:59 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function suite.include_runsOnlyOnce_onMultipleIncludesWithDifferentPaths()
|
|
|
|
include "folder/premake4.lua"
|
|
|
|
include "../tests/folder/premake4.lua"
|
2014-02-08 15:44:57 +00:00
|
|
|
test.isequal("ok", premake.captured())
|
2013-03-12 22:18:47 +00:00
|
|
|
end
|