added metatable support

This commit is contained in:
Enrique García Cota
2011-04-24 01:39:05 +02:00
parent 4ddef3ccae
commit 395b02ecbe
2 changed files with 30 additions and 11 deletions

View File

@@ -147,6 +147,19 @@ context( 'inspect', function()
end)
test('Should include the metatable as an extra hash attribute', function()
local foo = { foo = 1, __tostring = function(k) return 'foo' end }
local bar = setmetatable({a = 1}, foo)
assert_equal(inspect(bar), [[{
a = 1,
<metatable> = {
__tostring = <function>
foo = 1,
}
}]])
end)
end)