test makeset

This commit is contained in:
Starbeamrainbowlabs 2022-09-24 13:45:50 +01:00
parent bdaedf0e7a
commit 8f03c6473b
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -0,0 +1,32 @@
local makeset = require("worldeditadditions_core.utils.table.makeset")
describe("table.makeset", function()
it("should work with a single item", function()
local result = makeset({ "apples" })
assert.are.same(
{ apples = true },
result
)
end)
it("should work with 2 items", function()
local result = makeset({ "apples", "orange" })
assert.are.same(
{ apples = true, orange = true },
result
)
end)
it("should work with duplicate items", function()
local result = makeset({ "apples", "apples" })
assert.are.same(
{ apples = true },
result
)
end)
it("should work with duplicate items and non-duplicate items", function()
local result = makeset({ "apples", "oranges", "apples" })
assert.are.same(
{ apples = true, oranges = true },
result
)
end)
end)