Adapt tests to dynamically-generated field info

No need to freeze the field info tables anymore
develop
lethosor 2023-08-12 21:59:14 -04:00
parent fc6d4caa8e
commit 396b2d7832
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
2 changed files with 10 additions and 6 deletions

@ -1403,7 +1403,6 @@ static void PushFieldInfoSubTable(lua_State *state, const struct_field_info *fie
Lua::TableInsert(state, "original_name", field->extra->original_name);
}
}
// freeze_table(state); // TODO: make pairs() work
}
/**

@ -43,6 +43,13 @@ end
function test.nonexistent()
expect.nil_(df.coord._fields.nonexistent)
expect.error_match('string expected', function()
expect.nil_(df.coord._fields[2])
end)
expect.error_match('string expected', function()
expect.nil_(df.coord._fields[nil])
end)
end
function test.readonly()
@ -52,13 +59,11 @@ function test.readonly()
expect.error_match(READONLY_MSG, function()
df.coord._fields.nonexistent = 'foo'
end)
-- see TODOs in LuaTypes.cpp
-- expect.error_match(READONLY_MSG, function()
-- df.coord._fields.x.name = 'foo'
-- end)
expect.nil_(df.coord._fields.nonexistent)
-- should have no effect
df.coord._fields.x.name = 'foo'
expect.eq(df.coord._fields.x.name, 'x')
expect.nil_(df.coord._fields.nonexistent)
end
function test.circular_refs_init()