Added some runtime tests for ruby.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@9693 626c5289-ae23-0410-ae9c-e8d60b6d4f22
This commit is contained in:
parent
928f12bd44
commit
5be075f16f
7 changed files with 255 additions and 0 deletions
61
Examples/test-suite/ruby/apply_strings_runme.rb
Executable file
61
Examples/test-suite/ruby/apply_strings_runme.rb
Executable file
|
|
@ -0,0 +1,61 @@
|
|||
#!/usr/bin/env ruby
|
||||
#
|
||||
# Put script description here.
|
||||
#
|
||||
# Author:: gga
|
||||
# Copyright:: 2007
|
||||
# License:: Ruby
|
||||
#
|
||||
|
||||
require 'swig_assert'
|
||||
require 'apply_strings'
|
||||
|
||||
include Apply_strings
|
||||
|
||||
begin
|
||||
x = UcharPtr.new
|
||||
swig_assert( fail, "UcharPtr should not be defined")
|
||||
rescue NameError
|
||||
end
|
||||
|
||||
ptr = 'a'
|
||||
['UCharFunction', 'SCharFunction', 'CUCharFunction',
|
||||
'CSCharFunction'].each do |m|
|
||||
val = Apply_strings.send(m, ptr)
|
||||
swig_assert( val == ptr, "Apply_strings.#{m} #{val} == #{ptr}" )
|
||||
end
|
||||
|
||||
|
||||
['CharFunction', 'CCharFunction'].each do |m|
|
||||
begin
|
||||
val = Apply_strings.send(m, ptr)
|
||||
swig_assert( false, "Apply_strings.#{m} should raise TypeError" )
|
||||
rescue TypeError
|
||||
end
|
||||
end
|
||||
|
||||
ptr = 'a'
|
||||
foo = DirectorTest.new
|
||||
['UCharFunction', 'SCharFunction', 'CUCharFunction',
|
||||
'CSCharFunction'].each do |m|
|
||||
val = foo.send(m, ptr)
|
||||
swig_assert( val == ptr, "DirectorTest.#{m} #{val} == #{ptr}" )
|
||||
end
|
||||
|
||||
|
||||
['CharFunction', 'CCharFunction'].each do |m|
|
||||
begin
|
||||
val = foo.send(m, ptr)
|
||||
swig_assert( false, "DirectorTest.#{m} should raise TypeError" )
|
||||
rescue TypeError
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# ary = Apply_strings.DigitsGlobalB
|
||||
# { 0 => 'A',
|
||||
# 1 => 'B',
|
||||
# 2 => 'B' }.each do |k,v|
|
||||
# val = ary[k]
|
||||
# swig_assert( val == v, "Apply_strings.DigitsGlobalB[#{k}] #{val} != #{v}")
|
||||
# end
|
||||
Loading…
Add table
Add a link
Reference in a new issue