From 8679e5098eb5e19af8c608e97b06eb2ce33cf87b Mon Sep 17 00:00:00 2001 From: lethosor <lethosor@gmail.com> Date: Sat, 19 Jun 2021 02:15:48 -0400 Subject: [PATCH] Catch incorrect attrs returned by ipairs() --- test/structures/enum_attrs.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/test/structures/enum_attrs.lua b/test/structures/enum_attrs.lua index 9b67145529b..967d33c3b2d 100644 --- a/test/structures/enum_attrs.lua +++ b/test/structures/enum_attrs.lua @@ -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 @@ -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