This repository has been archived on 2022-12-23. You can view files and clone it, but cannot push or open issues or pull requests.
fuck-premake-old2/tests/actions/vstudio/vc2010/test_extension_targets.lua
Jason Perkins 4af8eb44af Clean up rule container creation and usage
- Adds externalRule() to match rule()
- Adds externalProject() as replacement for external() for consistency with rules
- Adds rules() to associate rules (external or generated) with a project
- Drops customRules(); use rules() on the project level instead
2014-10-20 15:41:00 -04:00

77 lines
1.6 KiB
Lua

--
-- tests/actions/vstudio/vc2010/test_extension_targets.lua
-- Check the import extension targets block of a VS 2010 project.
-- Copyright (c) 2014 Jason Perkins and the Premake project
--
local suite = test.declare("vs2010_import_targets")
local vc2010 = premake.vstudio.vc2010
local project = premake.project
--
-- Setup
--
local sln
function suite.setup()
rule "MyRules"
rule "MyOtherRules"
sln = test.createsolution()
end
local function prepare()
local prj = test.getproject(sln)
vc2010.importExtensionTargets(prj)
end
--
-- Writes an empty element when no custom rules are specified.
--
function suite.structureIsCorrect_onDefaultValues()
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
]]
end
--
-- Writes entries for each project scoped custom rules path.
--
function suite.addsImport_onEachRulesFile()
rules { "MyRules", "MyOtherRules" }
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="MyRules.targets" />
<Import Project="MyOtherRules.targets" />
</ImportGroup>
]]
end
--
-- Rule files use a project relative path.
--
function suite.usesProjectRelativePaths()
rules { "MyRules" }
location "build"
prepare()
test.capture [[
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
<Import Project="..\MyRules.targets" />
</ImportGroup>
]]
end