Merge pull request #2925 from SethBarberee/gears-iterate_value

More gears.table tests
This commit is contained in:
mergify[bot] 2019-11-26 15:16:00 +00:00 committed by GitHub
commit 42ec9c4ecf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 0 deletions

View File

@ -42,6 +42,27 @@ describe("gears.table", function()
end)
end)
describe("table.find_keys", function()
it("nil argument", function()
local t = { "a", "b", c = "c", "d" }
local f = gtable.find_keys(t, function(k) return k == "c" end)
assert.is.same(f, {"c"})
end)
end)
describe("table.hasitem", function()
it("exist", function()
local t = {"a", "b", c = "c"}
local f = gtable.hasitem(t, "c")
assert.is.equal(f, "c")
end)
it("nil", function()
local t = {"a", "b"}
local f = gtable.hasitem(t, "c")
assert.is.equal(f, nil)
end)
end)
describe("table.join", function()
it("nil argument", function()
local t = gtable.join({"a"}, nil, {"b"})