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:
Enrique García Cota
2011-08-13 00:52:55 +02:00
parent ca9e012357
commit 4c92bad614
5 changed files with 26 additions and 10 deletions

View File

@@ -1 +0,0 @@
../inspect.lua

View File

@@ -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)

View File

@@ -1,3 +0,0 @@
#!/usr/bin/env lua
os.execute("tsc -f inspect_spec.lua")