Codelite: Add tests for pre/postbuildcommands with escaped char

This commit is contained in:
Thomas Desveaux 2019-01-21 20:21:43 +01:00 committed by Sam Surtees
parent 37f9a09c0d
commit 3b31b6f054
4 changed files with 34 additions and 2 deletions

View File

@ -27,10 +27,9 @@
end
function codelite.esc(value)
local result = value:gsub('"', '\\"')
local result = value:gsub('&', '&')
result = result:gsub('<', '&lt;')
result = result:gsub('>', '&gt;')
result = result:gsub('&', '&amp;')
return result
end

View File

@ -17,6 +17,7 @@
function suite.setup()
p.action.set("codelite")
p.escaper(codelite.esc)
p.indent(" ")
wks = test.createWorkspace()
end
@ -198,6 +199,21 @@ cmd2</StartupCommands>
]]
end
function suite.OnProject_PreBuild_Escaped()
prebuildcommands {
"touch \"./build/copyright\" && echo OK",
"cat \"./lib/copyright\" >> \"./build/copyright\""
}
prepare()
codelite.project.preBuild(prj)
test.capture [[
<PreBuild>
<Command Enabled="yes">touch "./build/copyright" &amp;&amp; echo OK</Command>
<Command Enabled="yes">cat "./lib/copyright" &gt;&gt; "./build/copyright"</Command>
</PreBuild>
]]
end
function suite.OnProject_PostBuild()
postbuildcommands { "cmd0", "cmd1" }
prepare()
@ -210,6 +226,21 @@ cmd2</StartupCommands>
]]
end
function suite.OnProject_PostBuild_Escaped()
postbuildcommands {
"touch \"./build/copyright\" && echo OK",
"cat \"./lib/copyright\" >> \"./build/copyright\""
}
prepare()
codelite.project.postBuild(prj)
test.capture [[
<PostBuild>
<Command Enabled="yes">touch "./build/copyright" &amp;&amp; echo OK</Command>
<Command Enabled="yes">cat "./lib/copyright" &gt;&gt; "./build/copyright"</Command>
</PostBuild>
]]
end
-- TODO: test custom build

View File

@ -17,6 +17,7 @@
function suite.setup()
p.action.set("codelite")
p.escaper(codelite.esc)
p.indent(" ")
wks = test.createWorkspace()
end

View File

@ -18,6 +18,7 @@
function suite.setup()
p.action.set("codelite")
p.escaper(codelite.esc)
p.indent(" ")
wks = test.createWorkspace()
end