2020-07-26 00:11:20 -06:00
|
|
|
function test.index_name()
|
|
|
|
for _, k in ipairs(df.units_other_id) do
|
|
|
|
expect.eq(df.global.world.units.other[k]._kind, 'container')
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function test.index_name_bad()
|
2021-04-03 14:30:52 -06:00
|
|
|
expect.error_match('not found.$', function()
|
2020-07-26 00:11:20 -06:00
|
|
|
expect.eq(df.global.world.units.other.SOME_FAKE_NAME, 'container')
|
2021-04-03 14:30:52 -06:00
|
|
|
end)
|
2020-07-26 00:11:20 -06:00
|
|
|
end
|
|
|
|
|
|
|
|
function test.index_id()
|
|
|
|
for i in ipairs(df.units_other_id) do
|
2021-07-05 18:49:25 -06:00
|
|
|
expect.eq(df.global.world.units.other[i]._kind, 'container', df.units_other_id[i])
|
2020-07-26 00:11:20 -06:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
function test.index_id_bad()
|
2021-04-03 14:30:52 -06:00
|
|
|
expect.error_match('Cannot read field', function()
|
2020-07-26 00:11:20 -06:00
|
|
|
expect.eq(df.global.world.units.other[df.units_other_id._first_item - 1], 'container')
|
2021-04-03 14:30:52 -06:00
|
|
|
end)
|
|
|
|
expect.error_match('Cannot read field', function()
|
2020-07-26 00:11:20 -06:00
|
|
|
expect.eq(df.global.world.units.other[df.units_other_id._last_item + 1], 'container')
|
2021-04-03 14:30:52 -06:00
|
|
|
end)
|
2020-07-26 00:11:20 -06:00
|
|
|
end
|
|
|
|
|