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_resource_compile.lua

95 lines
2.1 KiB
Lua
Raw Normal View History

2012-01-27 18:37:24 +00:00
--
-- tests/actions/vstudio/vc2010/test_resource_compile.lua
-- Validate resource compiler settings in Visual Studio 2010 C/C++ projects.
2013-03-07 17:14:03 +00:00
-- Copyright (c) 2011-2013 Jason Perkins and the Premake project
2012-01-27 18:37:24 +00:00
--
2013-03-07 17:14:03 +00:00
local suite = test.declare("vs2010_resource_compiler")
2012-01-27 18:37:24 +00:00
local vc2010 = premake.vstudio.vc2010
local project = premake.project
2012-01-27 18:37:24 +00:00
--
-- Setup
--
local sln, prj
2012-01-27 18:37:24 +00:00
function suite.setup()
2014-01-09 23:06:03 +00:00
io.esc = vc2010.esc
2012-01-27 18:37:24 +00:00
sln, prj = test.createsolution()
end
2013-03-07 17:14:03 +00:00
local function prepare()
local cfg = test.getconfig(prj, "Debug")
2012-01-27 18:37:24 +00:00
vc2010.resourceCompile(cfg)
end
--
-- Check the basic element structure with default settings.
--
function suite.defaultSettings()
prepare()
test.capture [[
<ResourceCompile>
</ResourceCompile>
]]
end
2012-01-27 18:37:24 +00:00
--
-- 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
2013-03-07 17:14:03 +00:00
--
-- 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=\"1.0.0 (testing)\";%(PreprocessorDefinitions)</PreprocessorDefinitions>
]]
end