From 7a3d134d58c4e7621a9410b8c3308505073407f8 Mon Sep 17 00:00:00 2001 From: "R. Blaine Whittle" Date: Mon, 2 Oct 2017 16:44:10 -0700 Subject: [PATCH] added unit test for path objects that contain premake tokens. --- modules/vstudio/tests/_tests.lua | 1 + modules/vstudio/tests/vc2010/test_tokens.lua | 91 ++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 modules/vstudio/tests/vc2010/test_tokens.lua diff --git a/modules/vstudio/tests/_tests.lua b/modules/vstudio/tests/_tests.lua index 97ccf3cc..1d05e19b 100644 --- a/modules/vstudio/tests/_tests.lua +++ b/modules/vstudio/tests/_tests.lua @@ -84,6 +84,7 @@ return { "vc2010/test_rule_targets.lua", "vc2010/test_rule_vars.lua", "vc2010/test_rule_xml.lua", + "vc2010/test_tokens.lua", "vc2010/test_target_machine.lua", "vc2010/test_user_file.lua", "vc2010/test_vectorextensions.lua", diff --git a/modules/vstudio/tests/vc2010/test_tokens.lua b/modules/vstudio/tests/vc2010/test_tokens.lua new file mode 100644 index 00000000..22d4664e --- /dev/null +++ b/modules/vstudio/tests/vc2010/test_tokens.lua @@ -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 [[ + + + Document + cgc %(Identity) + ../%(Filename).a;../%(Filename).b + + + ]] + 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 [[ + + + Document + cgc %(Identity) + ../%(Filename).obj + Compiling shader %(Identity) + + + ]] + 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 [[ + + + Document + cgc %(Identity) + ../%(Filename).obj + ../common.cg.inc;../common.cg.inc2 + + + ]] + end + +