added unit test for path objects that contain premake tokens.

This commit is contained in:
R. Blaine Whittle 2017-10-02 16:44:10 -07:00 committed by Tom van Dijck
parent b88d4eff3e
commit 7a3d134d58
2 changed files with 92 additions and 0 deletions

View File

@ -84,6 +84,7 @@ return {
"vc2010/test_rule_targets.lua", "vc2010/test_rule_targets.lua",
"vc2010/test_rule_vars.lua", "vc2010/test_rule_vars.lua",
"vc2010/test_rule_xml.lua", "vc2010/test_rule_xml.lua",
"vc2010/test_tokens.lua",
"vc2010/test_target_machine.lua", "vc2010/test_target_machine.lua",
"vc2010/test_user_file.lua", "vc2010/test_user_file.lua",
"vc2010/test_vectorextensions.lua", "vc2010/test_vectorextensions.lua",

View File

@ -0,0 +1,91 @@
--
-- test_tokens.lua
-- Generate a NuGet packages.config file.
-- Copyright (c) Jason Perkins and the Premake project
--
local p = premake
local suite = test.declare("vstudio_vs2010_tokens")
local vc2010 = p.vstudio.vc2010
--
-- Setup
--
local wks, prj
function suite.setup()
p.action.set("vs2010")
wks = test.createWorkspace()
end
local function prepare()
prj = test.getproject(wks, 1)
vc2010.files(prj)
end
function suite.customBuild_onBuildRuleMultipleBuildOutputs()
location "projects"
files { "hello.cg" }
filter "files:**.cg"
buildcommands { "cgc %{file.relpath}" }
buildoutputs { "%{file.basename}.a", "%{file.basename}.b" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="..\hello.cg">
<FileType>Document</FileType>
<Command>cgc %(Identity)</Command>
<Outputs>../%(Filename).a;../%(Filename).b</Outputs>
</CustomBuild>
</ItemGroup>
]]
end
function suite.customBuild_onBuildRuleWithMessage()
location "projects"
files { "hello.cg" }
filter "files:**.cg"
buildmessage "Compiling shader %{file.relpath}"
buildcommands { "cgc %{file.relpath}" }
buildoutputs { "%{file.basename}.obj" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="..\hello.cg">
<FileType>Document</FileType>
<Command>cgc %(Identity)</Command>
<Outputs>../%(Filename).obj</Outputs>
<Message>Compiling shader %(Identity)</Message>
</CustomBuild>
</ItemGroup>
]]
end
function suite.customBuild_onBuildRuleWithAdditionalInputs()
location "projects"
files { "hello.cg" }
filter "files:**.cg"
buildcommands { "cgc %{file.relpath}" }
buildoutputs { "%{file.basename}.obj" }
buildinputs { "common.cg.inc", "common.cg.inc2" }
prepare()
test.capture [[
<ItemGroup>
<CustomBuild Include="..\hello.cg">
<FileType>Document</FileType>
<Command>cgc %(Identity)</Command>
<Outputs>../%(Filename).obj</Outputs>
<AdditionalInputs>../common.cg.inc;../common.cg.inc2</AdditionalInputs>
</CustomBuild>
</ItemGroup>
]]
end