git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8684 626c5289-ae23-0410-ae9c-e8d60b6d4f22
49 lines
1 KiB
Ruby
49 lines
1 KiB
Ruby
require 'abstract_inherit'
|
|
|
|
include Abstract_inherit
|
|
|
|
#
|
|
# Shouldn't be able to instantiate any of these classes
|
|
# since none of them implements the pure virtual function
|
|
# declared in the base class (Foo).
|
|
#
|
|
|
|
exceptionRaised = false
|
|
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
|
|
|
|
exceptionRaised = false
|
|
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
|
|
|
|
exceptionRaised = false
|
|
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
|
|
|