Skip to content

Commit d60ca79

Browse files
committed
Catch incorrect attrs returned by ipairs()
1 parent dde88dd commit d60ca79

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/structures/enum_attrs.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ end
6767

6868
function test.ipairs()
6969
local i = 0
70-
for index in ipairs(df.item_type.attrs) do
70+
for index, value in ipairs(df.item_type.attrs) do
7171
if i == 0 then
7272
expect.eq(index, df.item_type._first_item, 'ipairs() returned wrong start index')
7373
end
@@ -76,6 +76,8 @@ function test.ipairs()
7676
expect.fail('ipairs() returned too many items: ' .. tostring(i))
7777
break
7878
end
79+
expect.eq(value, df.item_type.attrs[i + df.item_type._first_item],
80+
'ipairs() returned incorrect attrs for item at index: ' .. tostring(index))
7981
end
8082
expect.eq(i, max_attrs_length(df.item_type))
8183
end

0 commit comments

Comments
 (0)