Skip to content

Commit

Permalink
Allow to use wildcard for buildinputs. (#2150)
Browse files Browse the repository at this point in the history
* Allow to use wildcard for `buildinputs`.

* Add UTs for `kind = "file"` for `api.register`
  • Loading branch information
Jarod42 authored Oct 31, 2023
1 parent e1b2a31 commit fee075f
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/_premake_init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
api.register {
name = "buildinputs",
scope = "config",
kind = "list:path",
kind = "list:file",
tokens = true,
pathVars = false,
}
Expand Down
1 change: 1 addition & 0 deletions tests/_tests.lua
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ return {
"api/test_boolean_kind.lua",
"api/test_containers.lua",
"api/test_directory_kind.lua",
"api/test_file_kind.lua",
"api/test_list_kind.lua",
"api/test_path_kind.lua",
"api/test_register.lua",
Expand Down
47 changes: 47 additions & 0 deletions tests/api/test_file_kind.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
--
-- tests/api/test_file_kind.lua
-- Tests the file API value type.
-- Copyright (c) 2023 the Premake project
--

local p = premake
local suite = test.declare("api_file_kind")
local api = p.api

--
-- Setup and teardown
--

function suite.setup()
api.register {
name = "testapi",
kind = "file",
list = true,
scope = "project"
}
test.createWorkspace()
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 (_TESTS_DIR .. "/api/*")

test.istrue(table.contains(api.scope.project.testapi, _TESTS_DIR .. "/api/test_file_kind.lua"))
end

0 comments on commit fee075f

Please sign in to comment.