This commit is contained in:
aaron 2023-08-06 23:16:58 +01:00
parent e03082c941
commit fa2709f182
8 changed files with 367 additions and 216 deletions

View file

@ -1054,15 +1054,33 @@ TEST("values()", function()
local input = source { 1, 2, 3 }
local output = values(input, function(v, i)
return v
return { v = v, i = i }
end)
input { 1, 2 }
local t = output()
CHECK(t[1] == 1)
CHECK(t[2] == 2)
CHECK(t[1].v == 1)
CHECK(t[2].v == 2)
CHECK(t[3] == nil)
end
do CASE "Removal reflected 2"
local input = source { 1 }
local output = values(input, function(v, i)
return { v = v, i = i }
end)
input { 2, 1 }
input { 1 }
local t = output()
CHECK(t[1].v == 1)
CHECK(t[1].i() == 1)
CHECK(t[2] == nil)
CHECK(t[3] == nil)
end
end)