swig/Examples/test-suite/ruby/namespace_class_runme.rb
Thomas Reitmayr 7963445048 Add and improve Ruby test cases in the context of nesting and namespaces
This is done in preparation for adding namespace support to the Ruby
part of SWIG. Some existing test cases were reorganized or duplicated
for flat/nonflat nesting. For some a Ruby test script was added.
Finally the ruby/Makefile.in was improved so that for test cases
without an explicit test script, the generated wrapper library will
be loaded by the Ruby interpreter to ensure loading works fine.
2020-12-16 22:30:46 +01:00

40 lines
745 B
Ruby

#!/usr/bin/env ruby
#
# This test implementation is directly derived from its Python counterpart.
#
require 'swig_assert'
require 'namespace_class'
begin
p = Namespace_class::Private1.new
raise SwigRubyError.new("Private1 is private")
rescue NameError => e
# OK
end
begin
p = Namespace_class::Private2.new
raise SwigRubyError.new("Private2 is private")
rescue NameError => e
# OK
end
Namespace_class::EulerT3D.toFrame(1, 1, 1)
b = Namespace_class::BooT_i.new
b = Namespace_class::BooT_H.new
f = Namespace_class::FooT_i.new
f.quack(1)
f = Namespace_class::FooT_d.new
f.moo(1)
f = Namespace_class::FooT_H.new
f.foo(Namespace_class::Hi)
f_type = f.class.to_s
swig_assert_equal('f_type', '"Namespace_class::FooT_H"', binding)