From c6baa21db4aaed837c7df1e61c420813c0d63a6b Mon Sep 17 00:00:00 2001 From: Charlie Savage Date: Tue, 10 Jan 2006 03:38:51 +0000 Subject: [PATCH] Updated to match change in exceptions thrown for previously deleted objects. git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@8344 626c5289-ae23-0410-ae9c-e8d60b6d4f22 --- Examples/ruby/free_function/runme.rb | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Examples/ruby/free_function/runme.rb b/Examples/ruby/free_function/runme.rb index a16019bdf..1d88b6f3e 100644 --- a/Examples/ruby/free_function/runme.rb +++ b/Examples/ruby/free_function/runme.rb @@ -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