mirror of
https://github.com/kikito/middleclass.git
synced 2024-11-08 09:34:22 +00:00
add test case for checking type of instance's __index
This commit is contained in:
parent
63f83ea0ef
commit
cc5cc98873
@ -100,6 +100,10 @@ describe('Metamethods', function()
|
|||||||
for k in pairs(v) do assert.not_table(k) end
|
for k in pairs(v) do assert.not_table(k) end
|
||||||
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()
|
it('implements __index', function()
|
||||||
assert.equal(b[1], 3)
|
assert.equal(b[1], 3)
|
||||||
@ -170,6 +174,10 @@ describe('Metamethods', function()
|
|||||||
for k in pairs(v2) do assert.not_table(k) end
|
for k in pairs(v2) do assert.not_table(k) end
|
||||||
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()
|
it('allows inheriting further', function()
|
||||||
local Vector3 = class('Vector3', Vector2)
|
local Vector3 = class('Vector3', Vector2)
|
||||||
local v3 = Vector3(1,2,3)
|
local v3 = Vector3(1,2,3)
|
||||||
|
Loading…
Reference in New Issue
Block a user