Updated to match change in exceptions thrown for previously deleted objects.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8344 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
e0b9b9903f
commit
f92005f00d
1 changed files with 8 additions and 7 deletions
|
|
@ -4,8 +4,8 @@ begin
|
|||
begin
|
||||
# Create an animal and zoo
|
||||
tiger1 = Example::Animal.new("tiger1")
|
||||
zoo = Example::Zoo.new
|
||||
|
||||
zoo = Example::Zoo.new
|
||||
|
||||
# At the animal to the zoo - this will transfer ownership
|
||||
# of the underlying C++ object to the C++ zoo object
|
||||
zoo.add_animal(tiger1)
|
||||
|
|
@ -36,10 +36,11 @@ GC.start
|
|||
|
||||
# This method is no longer valid since the zoo freed the underlying
|
||||
# C++ object
|
||||
ok = false
|
||||
begin
|
||||
puts tiger2.get_name
|
||||
rescue RuntimeError => error
|
||||
if not error.message == "This Animal * already released"
|
||||
raise
|
||||
end
|
||||
puts tiger2.get_name
|
||||
rescue ObjectPreviouslyDeleted => error
|
||||
ok = true
|
||||
end
|
||||
|
||||
raise(RuntimeError, "Incorrect exception raised - should be ObjectPreviouslyDeleted") unless ok
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue