Updates to examples so that they run correctly under Ruby 1.8
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@7491 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
a19ec091b8
commit
5cff7abd73
4 changed files with 73 additions and 1 deletions
|
|
@ -12,6 +12,10 @@ begin
|
|||
Foo.new
|
||||
rescue NameError
|
||||
exceptionRaised = true
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Abstract_inherit_ok::Foo
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
require 'abstract_inherit'
|
||||
require 'abstract_inherit'
|
||||
|
||||
include Abstract_inherit
|
||||
|
||||
|
|
@ -13,6 +13,10 @@ begin
|
|||
Foo.new
|
||||
rescue NameError
|
||||
exceptionRaised = true
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Abstract_inherit::Foo
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
|
@ -22,6 +26,10 @@ begin
|
|||
Bar.new
|
||||
rescue NameError
|
||||
exceptionRaised = true
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Abstract_inherit::Bar
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
|
@ -31,6 +39,10 @@ begin
|
|||
Spam.new
|
||||
rescue NameError
|
||||
exceptionRaised = true
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Abstract_inherit::Spam
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ begin
|
|||
Abstract_foo.new
|
||||
rescue NameError
|
||||
exceptionRaised = true
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Abstract_signature::Abstract_foo
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
|
@ -26,6 +30,10 @@ begin
|
|||
Abstract_bar.new
|
||||
rescue NameError
|
||||
exceptionRaised = true
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Abstract_signature::Abstract_bar
|
||||
exceptionRaised = true
|
||||
ensure
|
||||
raise RuntimeError unless exceptionRaised
|
||||
end
|
||||
|
|
|
|||
|
|
@ -18,6 +18,10 @@ begin
|
|||
b = B.new
|
||||
rescue ArgumentError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::BB
|
||||
exceptionRaised = true
|
||||
end
|
||||
|
||||
# The two-argument constructor for B should work
|
||||
|
|
@ -29,6 +33,10 @@ begin
|
|||
puts "Whoa. new BB created."
|
||||
rescue NoConstructorError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::BB
|
||||
exceptionRaised = true
|
||||
end
|
||||
|
||||
# C's constructor is protected, so this should raise an exception
|
||||
|
|
@ -37,6 +45,14 @@ begin
|
|||
print "Whoa. new C created."
|
||||
rescue NoConstructorError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::C
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::C
|
||||
# pass
|
||||
end
|
||||
|
||||
# CC gets a default constructor, so no problem here
|
||||
|
|
@ -48,6 +64,10 @@ begin
|
|||
puts "Whoa. new D created"
|
||||
rescue NoConstructorError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::D
|
||||
# pass
|
||||
end
|
||||
|
||||
# DD shouldn't get a default constructor, so this should fail
|
||||
|
|
@ -56,6 +76,18 @@ begin
|
|||
puts "Whoa. new DD created"
|
||||
rescue NoConstructorError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::DD
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::D
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::DD
|
||||
# pass
|
||||
end
|
||||
|
||||
# AD shouldn't get a default constructor, so this should fail
|
||||
|
|
@ -64,6 +96,14 @@ begin
|
|||
puts "Whoa. new AD created"
|
||||
rescue NoConstructorError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::AD
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::AD
|
||||
# pass
|
||||
end
|
||||
|
||||
# Both of the arguments to E's constructor have default values,
|
||||
|
|
@ -79,6 +119,14 @@ begin
|
|||
puts "Whoa. new EB created"
|
||||
rescue NoConstructorError
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::EB
|
||||
# pass
|
||||
rescue TypeError
|
||||
# In Ruby 1.8 the exception raised is:
|
||||
# TypeError: allocator undefined for Default_constructor::EB
|
||||
# pass
|
||||
end
|
||||
|
||||
# This should work fine
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue