*** empty log message ***
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk/SWIG@4474 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
87bf632747
commit
1b71d0bbd1
3 changed files with 102 additions and 0 deletions
33
Examples/test-suite/ruby/abstract_inherit_ok_runme.rb
Normal file
33
Examples/test-suite/ruby/abstract_inherit_ok_runme.rb
Normal file
|
|
@ -0,0 +1,33 @@
|
||||||
|
require 'abstract_inherit_ok'
|
||||||
|
|
||||||
|
include Abstract_inherit_ok
|
||||||
|
|
||||||
|
#
|
||||||
|
# Shouldn't be able to instantiate Foo, because it declares
|
||||||
|
# a pure virtual function.
|
||||||
|
#
|
||||||
|
|
||||||
|
exceptionRaised = false
|
||||||
|
begin
|
||||||
|
Foo.new
|
||||||
|
rescue NameError
|
||||||
|
exceptionRaised = true
|
||||||
|
ensure
|
||||||
|
raise RuntimeError unless exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# This one's OK since we cleared it with a %feature("notabstract")
|
||||||
|
# declaration in the interface file.
|
||||||
|
#
|
||||||
|
|
||||||
|
exceptionRaised = false
|
||||||
|
begin
|
||||||
|
spam = Spam.new
|
||||||
|
raise RuntimeError unless spam.blah == 0
|
||||||
|
rescue NameError
|
||||||
|
exceptionRaised = true
|
||||||
|
ensure
|
||||||
|
raise RuntimeError if exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
37
Examples/test-suite/ruby/abstract_inherit_runme.rb
Normal file
37
Examples/test-suite/ruby/abstract_inherit_runme.rb
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
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
|
||||||
|
ensure
|
||||||
|
raise RuntimeError unless exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
|
exceptionRaised = false
|
||||||
|
begin
|
||||||
|
Bar.new
|
||||||
|
rescue NameError
|
||||||
|
exceptionRaised = true
|
||||||
|
ensure
|
||||||
|
raise RuntimeError unless exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
|
exceptionRaised = false
|
||||||
|
begin
|
||||||
|
Spam.new
|
||||||
|
rescue NameError
|
||||||
|
exceptionRaised = true
|
||||||
|
ensure
|
||||||
|
raise RuntimeError unless exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
32
Examples/test-suite/ruby/abstract_signature_runme.rb
Normal file
32
Examples/test-suite/ruby/abstract_signature_runme.rb
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
require 'abstract_signature'
|
||||||
|
|
||||||
|
include Abstract_signature
|
||||||
|
|
||||||
|
#
|
||||||
|
# Shouldn't be able to instantiate Abstract_foo, because it declares
|
||||||
|
# a pure virtual function.
|
||||||
|
#
|
||||||
|
|
||||||
|
exceptionRaised = false
|
||||||
|
begin
|
||||||
|
Abstract_foo.new
|
||||||
|
rescue NameError
|
||||||
|
exceptionRaised = true
|
||||||
|
ensure
|
||||||
|
raise RuntimeError unless exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
|
#
|
||||||
|
# Shouldn't be able to instantiate an Abstract_bar either, because it doesn't
|
||||||
|
# implement the pure virtual function with the correct signature.
|
||||||
|
#
|
||||||
|
|
||||||
|
exceptionRaised = false
|
||||||
|
begin
|
||||||
|
Abstract_bar.new
|
||||||
|
rescue NameError
|
||||||
|
exceptionRaised = true
|
||||||
|
ensure
|
||||||
|
raise RuntimeError unless exceptionRaised
|
||||||
|
end
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue