Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
tests: test-object: add negative test case for extend Error
It seems that if you extend an error you lose the __tostring. This seems
like an object problem.
  • Loading branch information
philips committed Aug 27, 2012
1 parent 6727d4f commit 7583d5d
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/test-object.lua
Expand Up @@ -32,3 +32,12 @@ local foo2 = Foo:new(1)
assert(foo1 ~= foo2)
assert(tostring(foo1) ~= tostring(foo2))
assert(foo1.bar == foo2.bar)
local MyError = require('core').Error:extend()
function MyError:initialize(msg)
Error.initialize(self, msg)
end
local myerror = MyError:new("Hello World")
assert(tostring(myerror), "Hello World")
p(tostring(myerror))

0 comments on commit 7583d5d

Please sign in to comment.