---
-- codelite/tests/test_codelite_config.lua
-- Automated test suite for CodeLite project generation.
-- Copyright (c) 2015 Manu Evans and the Premake project
---
local suite = test.declare("codelite_cproj_config")
local p = premake
local codelite = p.modules.codelite
---------------------------------------------------------------------------
-- Setup/Teardown
---------------------------------------------------------------------------
local wks, prj, cfg
function suite.setup()
p.action.set("codelite")
p.indent(" ")
wks = test.createWorkspace()
end
local function prepare()
prj = test.getproject(wks,1)
cfg = test.getconfig(prj, "Debug")
end
function suite.OnProjectCfg_Compiler()
prepare()
codelite.project.compiler(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_Flags()
optimize "Debug"
exceptionhandling "Off"
rtti "Off"
pic "On"
symbols "On"
language "C++"
cppdialect "C++11"
flags { "NoBufferSecurityCheck" }
buildoptions { "-opt1", "-opt2" }
prepare()
codelite.project.compiler(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_Includes()
includedirs { "dir/", "dir2" }
prepare()
codelite.project.compiler(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_Defines()
defines { "TEST", "DEF" }
prepare()
codelite.project.compiler(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_Linker()
prepare()
codelite.project.linker(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_LibPath()
libdirs { "test/", "test2" }
prepare()
codelite.project.linker(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_Libs()
links { "a", "b" }
prepare()
codelite.project.linker(cfg)
test.capture [[
]]
end
-- TODO: test sibling lib project links
function suite.OnProjectCfg_ResCompiler()
prepare()
codelite.project.resourceCompiler(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_ResInclude()
files { "x.rc" }
resincludedirs { "dir/" }
prepare()
codelite.project.resourceCompiler(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_General()
system "Windows"
prepare()
codelite.project.general(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_Environment()
prepare()
codelite.project.environment(cfg)
test.capture(
' \n' ..
' \n' ..
' '
)
end
function suite.OnProjectCfg_Debugger()
prepare()
codelite.project.debugger(cfg)
test.capture [[
]]
end
function suite.OnProjectCfg_DebuggerOpts()
debugremotehost "localhost"
debugport(2345)
debugextendedprotocol(true)
debugsearchpaths { "search/", "path" }
debugconnectcommands { "connectcmd1", "cmd2" }
debugstartupcommands { "startcmd1", "cmd2" }
prepare()
codelite.project.debugger(cfg)
test.capture [[
search
path
connectcmd1
cmd2
startcmd1
cmd2
]]
end
function suite.OnProject_PreBuild()
prebuildcommands { "cmd0", "cmd1" }
prepare()
codelite.project.preBuild(prj)
test.capture [[
cmd0
cmd1
]]
end
function suite.OnProject_PreBuild()
postbuildcommands { "cmd0", "cmd1" }
prepare()
codelite.project.postBuild(prj)
test.capture [[
cmd0
cmd1
]]
end
-- TODO: test custom build
function suite.OnProject_AdditionalRules()
prepare()
codelite.project.additionalRules(prj)
test.capture [[
]]
end
function suite.OnProject_Completion()
language "C++"
cppdialect "C++11"
prepare()
codelite.project.completion(prj)
test.capture [[
]]
end