This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/tests/base/test_include.lua

68 lines
1.6 KiB
Lua
Raw Permalink Normal View History

--
-- tests/base/test_include.lua
-- Test the include() function, for including external scripts
-- Copyright (c) 2011-2014 Jason Perkins and the Premake project
--
2017-04-25 05:44:13 +00:00
local p = premake
local suite = test.declare("include")
--
-- Setup and teardown
--
function suite.teardown()
-- clear the list of included files after each run
io._includedFiles = { }
end
--
-- Tests
--
function suite.include_findsPremakeFile_onFolderNameOnly()
include (_TESTS_DIR .. "/folder")
2017-04-25 05:44:13 +00:00
test.isequal("ok", p.captured())
end
function suite.include_onExactFilename()
include (_TESTS_DIR .. "/folder/premake5.lua")
2017-04-25 05:44:13 +00:00
test.isequal("ok", p.captured())
end
function suite.include_runsOnlyOnce_onMultipleIncludes()
include (_TESTS_DIR .. "/folder/premake5.lua")
include (_TESTS_DIR .. "/folder/premake5.lua")
2017-04-25 05:44:13 +00:00
test.isequal("ok", p.captured())
end
function suite.include_runsOnlyOnce_onMultipleIncludesWithDifferentPaths()
include (_TESTS_DIR .. "/folder/premake5.lua")
include (_TESTS_DIR .. "/../tests/folder/premake5.lua")
2017-04-25 05:44:13 +00:00
test.isequal("ok", p.captured())
end
function suite.includeexternal_runs()
includeexternal (_TESTS_DIR .. "/folder/premake5.lua")
2017-04-25 05:44:13 +00:00
test.isequal("ok", p.captured())
end
function suite.includeexternal_runsAfterInclude()
include (_TESTS_DIR .. "/folder/premake5.lua")
includeexternal (_TESTS_DIR .. "/folder/premake5.lua")
2017-04-25 05:44:13 +00:00
test.isequal("okok", p.captured())
end
function suite.includeexternal_runsTwiceAfterInclude()
include (_TESTS_DIR .. "/folder/premake5.lua")
includeexternal (_TESTS_DIR .. "/folder/premake5.lua")
includeexternal (_TESTS_DIR .. "/folder/premake5.lua")
2017-04-25 05:44:13 +00:00
test.isequal("okokok", p.captured())
end