add test case for checking type of instance's __index

This commit is contained in:
jojo59516 2019-11-27 11:21:56 +08:00
parent 63f83ea0ef
commit cc5cc98873

View File

@ -100,6 +100,10 @@ describe('Metamethods', function()
for k in pairs(v) do assert.not_table(k) end
end)
it('instance should have a table __index if not overrided', function()
assert.is_true(type(debug.getmetatable(v).__index) == 'table')
end)
--[[
it('implements __index', function()
assert.equal(b[1], 3)
@ -170,6 +174,10 @@ describe('Metamethods', function()
for k in pairs(v2) do assert.not_table(k) end
end)
it('instance should also have a table __index if not overrided', function()
assert.is_true(type(debug.getmetatable(v2).__index) == 'table')
end)
it('allows inheriting further', function()
local Vector3 = class('Vector3', Vector2)
local v3 = Vector3(1,2,3)