premake/tests/actions/vstudio/vc2010/test_resource_compile.lua
Jason Perkins dd639ec1e2 Applied pull requests #38 and #43: Fix escaping of quotes for resource preprocessor.
Sticking with the wonky quotes for now; will fix the escaping in a separate commit.
2013-04-30 12:25:25 -04:00

94 lines
2.1 KiB
Lua
Executable File

--
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
--
local suite = test.declare("vs2010_resource_compiler")
local vc2010 = premake.vstudio.vc2010
local project = premake5.project
--
-- Setup
--
local sln, prj, cfg
function suite.setup()
sln, prj = test.createsolution()
end
local function prepare()
cfg = project.getconfig(prj, "Debug")
vc2010.resourceCompile(cfg)
end
--
-- Check the basic element structure with default settings.
--
function suite.defaultSettings()
prepare()
test.capture [[
<ResourceCompile>
</ResourceCompile>
]]
end
--
-- If defines are specified, the <PreprocessorDefinitions> element should be added.
--
function suite.preprocessorDefinitions_onDefines()
defines { "DEBUG" }
resdefines { "RESOURCES" }
prepare()
test.capture [[
<ResourceCompile>
<PreprocessorDefinitions>DEBUG;RESOURCES;%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
end
--
-- If include directories are specified, the <AdditionalIncludeDirectories> should be added.
--
function suite.additionalIncludeDirs_onIncludeDirs()
includedirs { "include/lua" }
resincludedirs { "include/zlib" }
prepare()
test.capture [[
<ResourceCompile>
<AdditionalIncludeDirectories>include\lua;include\zlib;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
]]
end
--
-- Xbox 360 doesn't use the resource compiler.
--
function suite.skips_onXbox360()
system "Xbox360"
prepare()
test.isemptycapture()
end
--
-- Test special escaping for preprocessor definition with quotes.
--
function suite.preprocessorDefinitions_onDefinesEscaping()
defines { "VERSION_STRING=\"1.0.0 (testing)\"" }
prepare()
test.capture [[
<ResourceCompile>
<PreprocessorDefinitions>VERSION_STRING=\&quot;1.0.0 (testing)\&quot;;%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
end