Initial community commit

This commit is contained in:
Jef
2024-09-24 14:54:57 +02:00
parent 537bcbc862
commit 20d28e80a5
16810 changed files with 4640254 additions and 2 deletions

View File

@@ -0,0 +1,85 @@
--
-- tests/workspace/test_eachconfig.lua
-- Automated test suite for the workspace-level configuration iterator.
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
--
local suite = test.declare("workspace_eachconfig")
local p = premake
--
-- Setup and teardown
--
local wks
function suite.setup()
wks = workspace("MyWorkspace")
end
local function prepare()
p.w("-")
for cfg in p.workspace.eachconfig(wks) do
p.w("%s:%s", cfg.buildcfg or "", cfg.platform or "")
end
p.w("-")
end
--
-- All configurations listed at the workspace level should be enumerated.
--
function suite.listsBuildConfigurations_onWorkspaceLevel()
configurations { "Debug", "Release" }
project("MyProject")
prepare()
test.capture [[
-
Debug:
Release:
-
]]
end
--
-- Iteration order should be build configurations, then platforms.
--
function suite.listsInOrder_onBuildConfigsAndPlatforms()
configurations { "Debug", "Release" }
platforms { "x86", "x86_64" }
project("MyProject")
prepare()
test.capture [[
-
Debug:x86
Debug:x86_64
Release:x86
Release:x86_64
-
]]
end
--
-- Configurations listed at the project level should *not* be included
-- in the workspace-level lists.
--
function suite.excludesProjectLevelConfigs()
configurations { "Debug", "Release" }
project ("MyProject")
configurations { "PrjDebug", "PrjRelease" }
platforms { "x86", "x86_64" }
prepare()
test.capture [[
-
Debug:
Release:
-
]]
end

View File

@@ -0,0 +1,44 @@
--
-- tests/workspace/test_location.lua
-- Test handling of the workspace's location field.
-- Copyright (c) 2013-2015 Jason Perkins and the Premake project
--
local suite = test.declare("workspace_location")
--
-- Setup and teardown
--
local wks
function suite.setup()
wks = workspace("MyWorkspace")
end
local function prepare()
wks = test.getWorkspace(wks)
end
--
-- If no explicit location is set, the location should be set to the
-- directory containing the script which defined the workspace.
--
function suite.usesScriptLocation_onNoLocation()
prepare()
test.isequal(os.getcwd(), wks.location)
end
--
-- If an explicit location has been set, use it.
--
function suite.usesLocation_onLocationSet()
location "build"
prepare()
test.isequal(path.join(os.getcwd(), "build"), wks.location)
end

View File

@@ -0,0 +1,86 @@
--
-- tests/workspace/test_objdirs.lua
-- Test the workspace unique objects directory building.
-- Copyright (c) 2012-2015 Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("workspace_objdir")
--
-- Setup and teardown
--
local wks
function suite.setup()
p.action.set("test")
wks = workspace("MyWorkspace")
system "macosx"
end
local function result()
local platforms = wks.platforms or {}
local prj = project("MyProject")
local cfg = test.getconfig(prj, "Debug", platforms[1])
return p.project.getrelative(cfg.project, cfg.objdir)
end
--
-- Objects directory should "obj" by default.
--
function suite.directoryIsObj_onNoValueSet()
configurations { "Debug" }
test.isequal("obj", result())
end
--
-- If a conflict occurs between platforms, the platform names should
-- be used to make unique.
--
function suite.directoryIncludesPlatform_onPlatformConflict()
configurations { "Debug" }
platforms { "x86", "x86_64" }
test.isequal("obj/x86", result())
end
--
-- If a conflict occurs between build configurations, the build
-- configuration names should be used to make unique.
--
function suite.directoryIncludesBuildCfg_onBuildCfgConflict()
configurations { "Debug", "Release" }
test.isequal("obj/Debug", result())
end
--
-- If a conflict occurs between both build configurations and platforms,
-- both should be used to make unique.
--
function suite.directoryIncludesBuildCfg_onPlatformAndBuildCfgConflict()
configurations { "Debug", "Release" }
platforms { "x86", "x86_64" }
test.isequal("obj/x86/Debug", result())
end
--
-- If a conflict occurs between projects, the project name should be
-- used to make unique.
--
function suite.directoryIncludesBuildCfg_onProjectConflict()
configurations { "Debug", "Release" }
project "MyProject2"
test.isequal("obj/Debug/MyProject", result())
end