swig/Examples/test-suite/ruby/abstract_signature_runme.rb
Gonzalo Garramuno a100f16bbd Fixes to std_map and multimap. There's still a problem
of const correctness in the std swig STL library.  
Need to bring it up in the swig-devel list.

Added new functions to swig_assert.
Changed some tests to reflect these changes.



git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9730 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2007-05-01 01:08:17 +00:00

62 lines
1.2 KiB
Ruby

#!/usr/bin/env ruby
#
# Put description here
#
# Author:: gga
# Copyright:: 2007
# License:: SWIG
#
require 'swig_assert'
require 'abstract_signature'
include Abstract_signature
#
# Shouldn't be able to instantiate Abstract_foo, because it declares
# a pure virtual function.
#
exceptionRaised = false
begin
foo = Abstract_foo.new
begin
foo.meth(1)
rescue RuntimeError
# here we are using directors
exceptionRaised = true
end
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
swig_assert( "exceptionRaised", binding)
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
bar = Abstract_bar.new
begin
bar.meth(1)
rescue RuntimeError
# here we are using directors
exceptionRaised = true
end
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
swig_assert( "exceptionRaised", binding)
end