2008-10-31 18:38:05 +00:00
|
|
|
--
|
2008-12-15 15:00:35 +00:00
|
|
|
-- tests/test_project.lua
|
2008-10-31 18:38:05 +00:00
|
|
|
-- Automated test suite for the project support functions.
|
2010-05-10 20:02:58 +00:00
|
|
|
-- Copyright (c) 2008-2010 Jason Perkins and the Premake project
|
2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
|
2009-08-11 23:29:46 +00:00
|
|
|
local _project = premake.project
|
|
|
|
|
2008-10-31 18:38:05 +00:00
|
|
|
T.project = { }
|
|
|
|
|
2009-05-28 19:13:50 +00:00
|
|
|
local cfg, result
|
2008-10-31 18:38:05 +00:00
|
|
|
function T.project.setup()
|
|
|
|
_ACTION = "gmake"
|
2009-05-28 19:13:50 +00:00
|
|
|
cfg = {}
|
2009-06-08 15:36:28 +00:00
|
|
|
cfg.project = {}
|
|
|
|
cfg.language = "C++"
|
2009-05-28 19:13:50 +00:00
|
|
|
cfg.files = {}
|
|
|
|
cfg.trimpaths = {}
|
2009-06-08 15:36:28 +00:00
|
|
|
cfg.platform = "Native"
|
2009-05-28 19:06:08 +00:00
|
|
|
result = "\n"
|
2008-10-31 18:38:05 +00:00
|
|
|
end
|
2009-08-11 23:29:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2010-05-10 20:02:58 +00:00
|
|
|
--
|
|
|
|
-- findproject() tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.project.findproject_IsCaseSensitive()
|
|
|
|
local sln = test.createsolution()
|
|
|
|
local prj = test.createproject(sln)
|
2011-05-18 21:32:04 +00:00
|
|
|
premake.bake.buildconfigs()
|
2010-05-10 20:02:58 +00:00
|
|
|
test.isnil(premake.findproject("myproject"))
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2009-08-11 23:29:46 +00:00
|
|
|
--
|
|
|
|
-- getfilename() tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.project.getfilename_ReturnsRelativePath()
|
|
|
|
local prj = { name = "project", location = "location" }
|
|
|
|
local r = _project.getfilename(prj, path.join(os.getcwd(), "../filename"))
|
|
|
|
test.isequal("../filename", r)
|
|
|
|
end
|
2009-04-09 20:02:49 +00:00
|
|
|
|
2009-08-11 23:29:46 +00:00
|
|
|
function T.project.getfilename_PerformsSubstitutions()
|
|
|
|
local prj = { name = "project", location = "location" }
|
2009-08-12 15:22:44 +00:00
|
|
|
local r = _project.getfilename(prj, "%%.prj")
|
2009-08-11 23:29:46 +00:00
|
|
|
test.isequal("location/project.prj", r)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
2009-06-08 15:36:28 +00:00
|
|
|
|
|
|
|
--
|
|
|
|
-- premake.getlinks() tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.project.getlinks_OnMscSystemLibs()
|
|
|
|
_OPTIONS.cc = "msc"
|
|
|
|
cfg.links = { "user32", "gdi32" }
|
|
|
|
result = premake.getlinks(cfg, "all", "fullpath")
|
|
|
|
test.isequal("user32.lib gdi32.lib", table.concat(result, " "))
|
|
|
|
end
|