Clean up vpath tests before porting back to stable
This commit is contained in:
parent
cb2435faf6
commit
e4d62bd307
@ -13,17 +13,16 @@
|
|||||||
-- Setup and teardown
|
-- Setup and teardown
|
||||||
--
|
--
|
||||||
|
|
||||||
local sln, prj, cfg
|
local sln
|
||||||
local cwd
|
|
||||||
|
|
||||||
function suite.setup()
|
function suite.setup()
|
||||||
sln = test.createsolution()
|
sln = test.createsolution()
|
||||||
cwd = os.getcwd() .. '/'
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local function prepare()
|
local function run()
|
||||||
prj = premake.solution.getproject_ng(sln, 1)
|
local prj = premake.solution.getproject_ng(sln, 1)
|
||||||
cfg = project.getconfig(prj, "Debug")
|
local cfg = project.getconfig(prj, "Debug")
|
||||||
|
return project.getvpath(prj, cfg.files[1])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -33,50 +32,44 @@
|
|||||||
|
|
||||||
function suite.ReturnsOriginalPath_OnNoVpaths()
|
function suite.ReturnsOriginalPath_OnNoVpaths()
|
||||||
files { "hello.c" }
|
files { "hello.c" }
|
||||||
prepare()
|
test.isequal(path.join(os.getcwd(), "hello.c"), run())
|
||||||
test.isequal(cfg.files[1], project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ReturnsOriginalPath_OnNoMatches()
|
function suite.ReturnsOriginalPath_OnNoMatches()
|
||||||
files { "hello.c" }
|
files { "hello.c" }
|
||||||
vpaths { ["Headers"] = "**.h" }
|
vpaths { ["Headers"] = "**.h" }
|
||||||
prepare()
|
test.isequal(path.join(os.getcwd(), "hello.c"), run())
|
||||||
test.isequal(cfg.files[1], project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.CanStripPaths()
|
function suite.CanStripPaths()
|
||||||
files { "src/myproject/hello.c" }
|
files { "src/myproject/hello.c" }
|
||||||
vpaths { [""] = "src" }
|
vpaths { [""] = "src" }
|
||||||
prepare()
|
run()
|
||||||
test.isequal("hello.c", project.getvpath(prj, cfg.files[1]))
|
test.isequal("hello.c", run())
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.CanTrimLeadingPaths()
|
function suite.CanTrimLeadingPaths()
|
||||||
files { "src/myproject/hello.c" }
|
files { "src/myproject/hello.c" }
|
||||||
vpaths { ["*"] = "src" }
|
vpaths { ["*"] = "src" }
|
||||||
prepare()
|
test.isequal("myproject/hello.c", run())
|
||||||
test.isequal("myproject/hello.c", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.PatternMayIncludeTrailingSlash()
|
function suite.PatternMayIncludeTrailingSlash()
|
||||||
files { "src/myproject/hello.c" }
|
files { "src/myproject/hello.c" }
|
||||||
vpaths { [""] = "src/myproject/" }
|
vpaths { [""] = "src/myproject/" }
|
||||||
prepare()
|
test.isequal("hello.c", run())
|
||||||
test.isequal("hello.c", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.SimpleReplacementPatterns()
|
function suite.SimpleReplacementPatterns()
|
||||||
files { "src/myproject/hello.c" }
|
files { "src/myproject/hello.c" }
|
||||||
vpaths { ["sources"] = "src/myproject" }
|
vpaths { ["sources"] = "src/myproject" }
|
||||||
prepare()
|
test.isequal("sources/hello.c", run())
|
||||||
test.isequal("sources/hello.c", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.ExactFilenameMatch()
|
function suite.ExactFilenameMatch()
|
||||||
files { "src/hello.c" }
|
files { "src/hello.c" }
|
||||||
vpaths { ["sources"] = "src/hello.c" }
|
vpaths { ["sources"] = "src/hello.c" }
|
||||||
prepare()
|
test.isequal("sources/hello.c", run())
|
||||||
test.isequal("sources/hello.c", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -87,57 +80,49 @@
|
|||||||
function suite.MatchFilePattern_ToGroup_Flat()
|
function suite.MatchFilePattern_ToGroup_Flat()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Headers"] = "**.h" }
|
vpaths { ["Headers"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Headers/hello.h", run())
|
||||||
test.isequal("Headers/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToNone_Flat()
|
function suite.MatchFilePattern_ToNone_Flat()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { [""] = "**.h" }
|
vpaths { [""] = "**.h" }
|
||||||
prepare()
|
test.isequal("hello.h", run())
|
||||||
test.isequal("hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToNestedGroup_Flat()
|
function suite.MatchFilePattern_ToNestedGroup_Flat()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Source/Headers"] = "**.h" }
|
vpaths { ["Source/Headers"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Source/Headers/hello.h", run())
|
||||||
test.isequal("Source/Headers/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToGroup_WithTrailingSlash()
|
function suite.MatchFilePattern_ToGroup_WithTrailingSlash()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Headers/"] = "**.h" }
|
vpaths { ["Headers/"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Headers/hello.h", run())
|
||||||
test.isequal("Headers/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToNestedGroup_Flat()
|
function suite.MatchFilePattern_ToNestedGroup_Flat()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Group/Headers"] = "**.h" }
|
vpaths { ["Group/Headers"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Group/Headers/hello.h", run())
|
||||||
test.isequal("Group/Headers/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToGroup_Nested()
|
function suite.MatchFilePattern_ToGroup_Nested()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Headers/*"] = "**.h" }
|
vpaths { ["Headers/*"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Headers/src/myproject/hello.h", run())
|
||||||
test.isequal("Headers/src/myproject/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_ToGroup_Nested_OneStar()
|
function suite.MatchFilePattern_ToGroup_Nested_OneStar()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Headers/*"] = "**.h" }
|
vpaths { ["Headers/*"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Headers/src/myproject/hello.h", run())
|
||||||
test.isequal("Headers/src/myproject/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePatternWithPath_ToGroup_Nested()
|
function suite.MatchFilePatternWithPath_ToGroup_Nested()
|
||||||
files { "src/myproject/hello.h" }
|
files { "src/myproject/hello.h" }
|
||||||
vpaths { ["Headers/*"] = "src/**.h" }
|
vpaths { ["Headers/*"] = "src/**.h" }
|
||||||
prepare()
|
test.isequal("Headers/myproject/hello.h", run())
|
||||||
test.isequal("Headers/myproject/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
@ -149,22 +134,19 @@
|
|||||||
location "build"
|
location "build"
|
||||||
files "src/hello.h"
|
files "src/hello.h"
|
||||||
vpaths { [""] = "src" }
|
vpaths { [""] = "src" }
|
||||||
prepare()
|
test.isequal("hello.h", run())
|
||||||
test.isequal("hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePattern_OnProjectLocationSet()
|
function suite.MatchFilePattern_OnProjectLocationSet()
|
||||||
location "build"
|
location "build"
|
||||||
files "src/hello.h"
|
files "src/hello.h"
|
||||||
vpaths { ["Headers"] = "**.h" }
|
vpaths { ["Headers"] = "**.h" }
|
||||||
prepare()
|
test.isequal("Headers/hello.h", run())
|
||||||
test.isequal("Headers/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function suite.MatchFilePatternWithPath_OnProjectLocationSet()
|
function suite.MatchFilePatternWithPath_OnProjectLocationSet()
|
||||||
location "build"
|
location "build"
|
||||||
files "src/hello.h"
|
files "src/hello.h"
|
||||||
vpaths { ["Headers"] = "src/**.h" }
|
vpaths { ["Headers"] = "src/**.h" }
|
||||||
prepare()
|
test.isequal("Headers/hello.h", run())
|
||||||
test.isequal("Headers/hello.h", project.getvpath(prj, cfg.files[1]))
|
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user