2012-11-28 16:14:47 +00:00
|
|
|
--
|
|
|
|
-- tests/actions/vstudio/cs2005/test_build_events.lua
|
|
|
|
-- Check generation of pre- and post-build commands for C# projects.
|
2013-05-22 15:15:48 +00:00
|
|
|
-- Copyright (c) 2012-2013 Jason Perkins and the Premake project
|
2012-11-28 16:14:47 +00:00
|
|
|
--
|
|
|
|
|
2013-05-22 15:15:48 +00:00
|
|
|
local suite = test.declare("vstudio_cs2005_build_events")
|
2012-11-28 16:14:47 +00:00
|
|
|
local cs2005 = premake.vstudio.cs2005
|
|
|
|
|
|
|
|
|
|
|
|
--
|
2013-05-22 15:15:48 +00:00
|
|
|
-- Setup
|
2012-11-28 16:14:47 +00:00
|
|
|
--
|
|
|
|
|
|
|
|
local sln, prj, cfg
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2012-11-28 16:14:47 +00:00
|
|
|
function suite.setup()
|
2013-05-22 15:15:48 +00:00
|
|
|
io.esc = premake.vstudio.vs2005.esc
|
2012-11-28 16:14:47 +00:00
|
|
|
sln = test.createsolution()
|
|
|
|
end
|
2013-05-22 15:15:48 +00:00
|
|
|
|
2012-11-28 16:14:47 +00:00
|
|
|
local function prepare(platform)
|
2013-09-13 15:52:00 +00:00
|
|
|
prj = premake.solution.getproject(sln, 1)
|
2012-11-28 16:14:47 +00:00
|
|
|
cs2005.buildEvents(prj)
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If no build steps are specified, nothing should be written.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.noOutput_onNoEvents()
|
|
|
|
prepare()
|
|
|
|
test.isemptycapture()
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- If one command set is used and not the other, only the one should be written.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.onlyOne_onPreBuildOnly()
|
|
|
|
prebuildcommands { "command1" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup>
|
|
|
|
<PreBuildEvent>command1</PreBuildEvent>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.onlyOne_onPostBuildOnly()
|
|
|
|
postbuildcommands { "command1" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup>
|
|
|
|
<PostBuildEvent>command1</PostBuildEvent>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
function suite.both_onBoth()
|
|
|
|
prebuildcommands { "command1" }
|
|
|
|
postbuildcommands { "command2" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup>
|
|
|
|
<PreBuildEvent>command1</PreBuildEvent>
|
|
|
|
<PostBuildEvent>command2</PostBuildEvent>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
--
|
|
|
|
-- Multiple commands are separated with escaped EOL characters.
|
|
|
|
--
|
|
|
|
|
|
|
|
function suite.splits_onMultipleCommands()
|
|
|
|
postbuildcommands { "command1", "command2" }
|
|
|
|
prepare()
|
|
|
|
test.capture [[
|
|
|
|
<PropertyGroup>
|
|
|
|
<PostBuildEvent>command1
command2</PostBuildEvent>
|
|
|
|
</PropertyGroup>
|
|
|
|
]]
|
|
|
|
end
|
|
|
|
|