2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
-- tests/test_premake.lua
|
|
|
|
-- Automated test suite for the Premake support functions.
|
2009-08-12 01:16:15 +00:00
|
|
|
-- Copyright (c) 2008-2009 Jason Perkins and the Premake project
|
2008-10-31 18:38:05 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
|
|
|
|
T.premake = { }
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- premake.checktools() tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.premake.checktools_SetsDefaultTools()
|
|
|
|
_ACTION = "gmake"
|
|
|
|
premake.checktools()
|
|
|
|
test.isequal("gcc", _OPTIONS.cc)
|
2008-12-05 21:18:47 +00:00
|
|
|
test.isequal("mono", _OPTIONS.dotnet)
|
2008-10-31 18:38:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
function T.premake.checktools_Fails_OnToolMismatch()
|
|
|
|
_ACTION = "gmake"
|
|
|
|
_OPTIONS["cc"] = "xyz"
|
|
|
|
ok, err = premake.checktools()
|
|
|
|
test.isfalse( ok )
|
2008-12-05 21:18:47 +00:00
|
|
|
test.isequal("the GNU Make action does not support /cc=xyz (yet)", err)
|
2008-10-31 18:38:05 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
2009-08-12 01:16:15 +00:00
|
|
|
--
|
|
|
|
-- generate() tests
|
|
|
|
--
|
|
|
|
|
|
|
|
function T.premake.generate_OpensCorrectFile()
|
|
|
|
prj = { name = "MyProject", location = "MyLocation" }
|
2009-08-12 15:22:44 +00:00
|
|
|
premake.generate(prj, "%%.prj", function () end)
|
2009-08-12 01:16:15 +00:00
|
|
|
test.openedfile("MyLocation/MyProject.prj")
|
|
|
|
end
|
|
|
|
|
|
|
|
function T.premake.generate_ClosesFile()
|
|
|
|
prj = { name = "MyProject", location = "MyLocation" }
|
2009-08-12 15:22:44 +00:00
|
|
|
premake.generate(prj, "%%.prj", function () end)
|
2009-08-12 01:16:15 +00:00
|
|
|
test.closedfile(true)
|
|
|
|
end
|