Skip to content

Commit

Permalink
Catch incorrect attrs returned by ipairs()
Browse files Browse the repository at this point in the history
  • Loading branch information
lethosor committed Apr 1, 2022
1 parent 64e08e4 commit 8679e50
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion test/structures/enum_attrs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ end

function test.ipairs()
local i = 0
for index in ipairs(df.item_type.attrs) do
for index, value in ipairs(df.item_type.attrs) do
if i == 0 then
expect.eq(index, df.item_type._first_item, 'ipairs() returned wrong start index')
end
Expand All @@ -76,6 +76,8 @@ function test.ipairs()
expect.fail('ipairs() returned too many items: ' .. tostring(i))
break
end
expect.eq(value, df.item_type.attrs[i + df.item_type._first_item],
'ipairs() returned incorrect attrs for item at index: ' .. tostring(index))
end
expect.eq(i, max_attrs_length(df.item_type))
end

0 comments on commit 8679e50

Please sign in to comment.