add tests for find_keys and hasitem
This commit is contained in:
parent
76f8c11776
commit
5d499db3d0
|
@ -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"})
|
||||
|
|
Loading…
Reference in New Issue