mirror of
https://github.com/TangentFoxy/inspect.lua.git
synced 2025-07-28 02:52:18 +00:00
simplified spec running. Added new instructions for it. Managed case where __toString throws an error. Made local a function that was global by mistake
This commit is contained in:
@@ -186,6 +186,18 @@ context( 'inspect', function()
|
||||
}]])
|
||||
end)
|
||||
|
||||
test('Should not include an error string if __tostring metamethod throws an error', function()
|
||||
local foo = { foo = 1, __tostring = function() error('hello', 0) end }
|
||||
local bar = setmetatable({a = 1}, foo)
|
||||
assert_equal(inspect(bar), [[<1>{ -- error: hello
|
||||
a = 1,
|
||||
<metatable> = <2>{
|
||||
__tostring = <function 1>,
|
||||
foo = 1
|
||||
}
|
||||
}]])
|
||||
end)
|
||||
|
||||
|
||||
end)
|
||||
|
||||
|
Reference in New Issue
Block a user