Fixed bug in directory field wildcard expansion (h/t StiX)
This commit is contained in:
parent
4bb62af458
commit
20b324201e
@ -383,7 +383,7 @@
|
||||
if value:find("*") then
|
||||
local values = os.matchdirs(value)
|
||||
table.foreachi(values, function(v)
|
||||
api.setdirectory(target, name, field, values[i])
|
||||
api.setdirectory(target, name, field, v)
|
||||
name = name + 1
|
||||
end)
|
||||
else
|
||||
|
47
tests/api/test_directory_kind.lua
Normal file
47
tests/api/test_directory_kind.lua
Normal file
@ -0,0 +1,47 @@
|
||||
--
|
||||
-- tests/api/test_directory_kind.lua
|
||||
-- Tests the directory API value type.
|
||||
-- Copyright (c) 2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local suite = test.declare("api_directory_kind")
|
||||
local api = premake.api
|
||||
|
||||
|
||||
--
|
||||
-- Setup and teardown
|
||||
--
|
||||
|
||||
function suite.setup()
|
||||
api.register {
|
||||
name = "testapi",
|
||||
kind = "directory-list",
|
||||
scope = "project"
|
||||
}
|
||||
test.createsolution()
|
||||
end
|
||||
|
||||
function suite.teardown()
|
||||
testapi = nil
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Values should be converted to absolute paths, relative to
|
||||
-- the currently running script.
|
||||
--
|
||||
|
||||
function suite.convertsToAbsolute()
|
||||
testapi "self/local"
|
||||
test.isequal({os.getcwd() .. "/self/local"}, api.scope.project.testapi)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Check expansion of wildcards.
|
||||
--
|
||||
|
||||
function suite.expandsWildcards()
|
||||
testapi "./*"
|
||||
test.istrue(table.contains(api.scope.project.testapi, os.getcwd() .. "/api"))
|
||||
end
|
@ -75,6 +75,7 @@
|
||||
dofile("api/test_array_kind.lua")
|
||||
dofile("api/test_callback.lua")
|
||||
dofile("api/test_containers.lua")
|
||||
dofile("api/test_directory_kind.lua")
|
||||
dofile("api/test_list_kind.lua")
|
||||
dofile("api/test_path_kind.lua")
|
||||
dofile("api/test_register.lua")
|
||||
|
Loading…
Reference in New Issue
Block a user