2012-02-19 17:31:20 +00:00
|
|
|
--
|
2015-08-30 15:38:35 +00:00
|
|
|
-- tests/workspace/test_eachconfig.lua
|
|
|
|
-- Automated test suite for the workspace-level configuration iterator.
|
|
|
|
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
|
2012-02-19 17:31:20 +00:00
|
|
|
--
|
|
|
|
|
2015-08-30 15:38:35 +00:00
|
|
|
local suite = test.declare("workspace_eachconfig")
|
|
|
|
|
|
|
|
local p = premake
|
2012-02-19 17:31:20 +00:00
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Setup and teardown
|
|
|
|
--
|
|
|
|
|
2015-08-28 20:16:14 +00:00
|
|
|
local wks
|
2015-08-30 15:38:35 +00:00
|
|
|
|
2012-02-19 17:31:20 +00:00
|
|
|
function suite.setup()
|
2015-08-30 15:38:35 +00:00
|
|
|
wks = workspace("MyWorkspace")
|
2012-02-19 17:31:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
local function prepare()
|
2015-08-30 15:38:35 +00:00
|
|
|
p.w("-")
|
|
|
|
for cfg in p.workspace.eachconfig(wks) do
|
|
|
|
p.w("%s:%s", cfg.buildcfg or "", cfg.platform or "")
|
2012-02-19 17:31:20 +00:00
|
|
|
end
|
2015-08-30 15:38:35 +00:00
|
|
|
p.w("-")
|
2012-02-19 17:31:20 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2015-08-30 15:38:35 +00:00
|
|
|
-- All configurations listed at the workspace level should be enumerated.
|
2012-02-19 17:31:20 +00:00
|
|
|
--
|
|
|
|
|
2015-08-30 15:38:35 +00:00
|
|
|
function suite.listsBuildConfigurations_onWorkspaceLevel()
|
2012-02-19 17:31:20 +00:00
|
|
|
configurations { "Debug", "Release" }
|
2012-03-05 22:45:42 +00:00
|
|
|
project("MyProject")
|
2012-02-19 17:31:20 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2015-08-30 15:38:35 +00:00
|
|
|
-
|
|
|
|
Debug:
|
|
|
|
Release:
|
|
|
|
-
|
2012-02-19 17:31:20 +00:00
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Iteration order should be build configurations, then platforms.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.listsInOrder_onBuildConfigsAndPlatforms()
|
|
|
|
configurations { "Debug", "Release" }
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
2012-03-05 22:45:42 +00:00
|
|
|
project("MyProject")
|
2012-02-19 17:31:20 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2015-08-30 15:38:35 +00:00
|
|
|
-
|
|
|
|
Debug:x86
|
|
|
|
Debug:x86_64
|
|
|
|
Release:x86
|
|
|
|
Release:x86_64
|
|
|
|
-
|
2012-02-19 17:31:20 +00:00
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2012-05-08 18:09:07 +00:00
|
|
|
-- Configurations listed at the project level should *not* be included
|
2015-08-30 15:38:35 +00:00
|
|
|
-- in the workspace-level lists.
|
2012-02-19 17:31:20 +00:00
|
|
|
--
|
|
|
|
|
2012-05-08 18:09:07 +00:00
|
|
|
function suite.excludesProjectLevelConfigs()
|
2012-02-19 17:31:20 +00:00
|
|
|
configurations { "Debug", "Release" }
|
2012-05-08 18:09:07 +00:00
|
|
|
project ("MyProject")
|
|
|
|
configurations { "PrjDebug", "PrjRelease" }
|
2015-04-13 22:27:11 +00:00
|
|
|
platforms { "x86", "x86_64" }
|
2012-02-19 17:31:20 +00:00
|
|
|
prepare()
|
|
|
|
test.capture [[
|
2015-08-30 15:38:35 +00:00
|
|
|
-
|
|
|
|
Debug:
|
|
|
|
Release:
|
|
|
|
-
|
2012-02-19 17:31:20 +00:00
|
|
|
]]
|
|
|
|
end
|