2010-09-05 20:10:28 +00:00
|
|
|
--
|
|
|
|
-- tests/test_config.lua
|
|
|
|
-- Automated test suite for the configuration handling functions.
|
|
|
|
-- Copyright (c) 2010 Jason Perkins and the Premake project
|
|
|
|
--
|
|
|
|
|
|
|
|
T.config = { }
|
|
|
|
local suite = T.config
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup/Teardown
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.setup()
|
|
|
|
sln = test.createsolution()
|
|
|
|
end
|
|
|
|
|
|
|
|
local cfg
|
|
|
|
local function prepare()
|
2011-05-18 21:32:04 +00:00
|
|
|
premake.bake.buildconfigs()
|
2010-09-05 20:10:28 +00:00
|
|
|
cfg = premake.solution.getproject(sln, 1)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Debug/Release build testing
|
|
|
|
--
|
2011-05-18 19:31:08 +00:00
|
|
|
function suite.IsDebug_ReturnsFalse_EnglishSpellingOfOptimiseFlag()
|
|
|
|
flags { "Optimise" }
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.IsDebug_ReturnsFalse_EnglishSpellingOfOptimiseSizeFlag()
|
|
|
|
flags { "OptimiseSize" }
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
2010-09-05 20:10:28 +00:00
|
|
|
|
2011-05-18 19:31:08 +00:00
|
|
|
function suite.IsDebug_ReturnsFalse_EnglishSpellingOfOptimiseSpeedFlag()
|
|
|
|
flags { "OptimiseSpeed" }
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
|
|
|
|
2010-09-05 20:10:28 +00:00
|
|
|
function suite.IsDebug_ReturnsFalse_OnOptimizeFlag()
|
|
|
|
flags { "Optimize" }
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.IsDebug_ReturnsFalse_OnOptimizeSizeFlag()
|
|
|
|
flags { "OptimizeSize" }
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.IsDebug_ReturnsFalse_OnOptimizeSpeedFlag()
|
|
|
|
flags { "OptimizeSpeed" }
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.IsDebug_ReturnsFalse_OnNoSymbolsFlag()
|
|
|
|
prepare()
|
|
|
|
return test.isfalse(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.IsDebug_ReturnsTrue_OnSymbolsFlag()
|
|
|
|
flags { "Symbols" }
|
|
|
|
prepare()
|
|
|
|
return test.istrue(premake.config.isdebugbuild(cfg))
|
|
|
|
end
|
2010-11-01 22:05:45 +00:00
|
|
|
|
|
|
|
function suite.shouldIncrementallyLink_staticLib_returnsFalse()
|
|
|
|
kind "StaticLib"
|
|
|
|
prepare()
|
2012-01-27 01:40:39 +00:00
|
|
|
return test.isfalse(premake.config.canincrementallink(cfg))
|
2010-11-01 22:05:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.shouldIncrementallyLink_optimizeFlagSet_returnsFalse()
|
|
|
|
flags { "Optimize" }
|
|
|
|
prepare()
|
2012-01-27 01:40:39 +00:00
|
|
|
return test.isfalse(premake.config.canincrementallink(cfg))
|
2010-11-01 22:05:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.shouldIncrementallyLink_NoIncrementalLinkFlag_returnsFalse()
|
|
|
|
flags { "NoIncrementalLink" }
|
|
|
|
prepare()
|
2012-01-27 01:40:39 +00:00
|
|
|
return test.isfalse(premake.config.canincrementallink(cfg))
|
2010-11-01 22:05:45 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
function suite.shouldIncrementallyLink_notStaticLib_NoIncrementalLinkFlag_noOptimiseFlag_returnsTrue()
|
|
|
|
prepare()
|
2012-01-27 01:40:39 +00:00
|
|
|
return test.istrue(premake.config.canincrementallink(cfg))
|
2010-11-01 22:05:45 +00:00
|
|
|
end
|
|
|
|
|