Added unit test, use p.esc
This commit is contained in:
parent
6b8cabad16
commit
9e34852bd7
@ -183,7 +183,8 @@
|
||||
for prj in p.workspace.eachproject(wks) do
|
||||
local deps = project.getdependencies(prj)
|
||||
deps = table.extract(deps, "name")
|
||||
_p('%s:%s', p.esc(prj.name), gmake2.list(deps))
|
||||
|
||||
_p('%s:%s', p.esc(prj.name), gmake2.list(p.esc(deps)))
|
||||
|
||||
local cfgvar = gmake2.tovar(prj.name)
|
||||
_p('ifneq (,$(%s_config))', cfgvar)
|
||||
|
@ -13,4 +13,5 @@ return {
|
||||
"test_gmake2_perfile_flags.lua",
|
||||
"test_gmake2_target_rules.lua",
|
||||
"test_gmake2_tools.lua",
|
||||
"test_gmake2_wks.lua"
|
||||
}
|
||||
|
70
modules/gmake2/tests/test_gmake2_wks.lua
Normal file
70
modules/gmake2/tests/test_gmake2_wks.lua
Normal file
@ -0,0 +1,70 @@
|
||||
local suite = test.declare("gmake2_wks")
|
||||
|
||||
local p = premake
|
||||
local gmake2 = premake.modules.gmake2
|
||||
|
||||
local wks, prj, cfg
|
||||
|
||||
function suite.setup()
|
||||
p.escaper(gmake2.esc)
|
||||
wks = workspace("MyWorkspace")
|
||||
configurations { "Debug", "Release" }
|
||||
end
|
||||
|
||||
|
||||
local function prepare()
|
||||
wks = test.getWorkspace(wks)
|
||||
prj = test.getproject(wks, 1)
|
||||
|
||||
gmake2.projectrules(wks)
|
||||
end
|
||||
|
||||
|
||||
function suite.projectwithspace()
|
||||
project "My Project"
|
||||
|
||||
prepare()
|
||||
|
||||
test.capture [[
|
||||
My\ Project:
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.projectwithdependencywithspace()
|
||||
project "Dependency with Space"
|
||||
project "My Project"
|
||||
dependson { "Dependency With Space" }
|
||||
|
||||
prepare()
|
||||
|
||||
test.capture [[
|
||||
Dependency\ with\ Space:
|
||||
ifneq (,$(Dependency_with_Space_config))
|
||||
@echo "==== Building Dependency with Space ($(Dependency_with_Space_config)) ===="
|
||||
@${MAKE} --no-print-directory -C . -f Dependency\ with\ Space.make config=$(Dependency_with_Space_config)
|
||||
endif
|
||||
|
||||
My\ Project: Dependency\ with\ Space
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.projectwithdependencywithspaceinlocation()
|
||||
project "Dependency with Space"
|
||||
location "Location With Space"
|
||||
project "My Project"
|
||||
dependson { "Dependency With Space" }
|
||||
|
||||
prepare()
|
||||
|
||||
test.capture [[
|
||||
Dependency\ with\ Space:
|
||||
ifneq (,$(Dependency_with_Space_config))
|
||||
@echo "==== Building Dependency with Space ($(Dependency_with_Space_config)) ===="
|
||||
@${MAKE} --no-print-directory -C Location\ With\ Space -f Makefile config=$(Dependency_with_Space_config)
|
||||
endif
|
||||
|
||||
My\ Project: Dependency\ with\ Space
|
||||
]]
|
||||
end
|
Loading…
Reference in New Issue
Block a user