mirror of
https://github.com/sbrl/Minetest-WorldEditAdditions.git
synced 2024-11-27 09:33:52 +01:00
test makeset
This commit is contained in:
parent
bdaedf0e7a
commit
8f03c6473b
32
.tests/parse/table/makeset.test.lua
Normal file
32
.tests/parse/table/makeset.test.lua
Normal 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)
|
Loading…
Reference in New Issue
Block a user