swig/SWIG/Examples/test-suite/ruby/naming_runme.rb
Charlie Savage 01597d58c1 Updated tests for constants.
git-svn-id: https://swig.svn.sourceforge.net/svnroot/swig/trunk@8457 626c5289-ae23-0410-ae9c-e8d60b6d4f22
2006-01-15 09:02:54 +00:00

64 lines
1.6 KiB
Ruby

require 'naming'
if not Naming
raise RuntimeError, 'Invalid module name for Naming'
end
if not Naming::MyClass
raise RuntimeError, 'Invalid class name for MyClass'
end
# Check method names
if not Naming::MyClass.instance_methods.include?('method_one')
raise RuntimeError, 'Invalid method name for method_one'
end
if not Naming::MyClass.instance_methods.include?('method_two')
raise RuntimeError, 'Invalid method name for method_two'
end
if not Naming::MyClass.instance_methods.include?('method_three')
raise RuntimeError, 'Invalid method name for method_three'
end
if not Naming::MyClass.instance_methods.include?('method44_4')
raise RuntimeError, 'Invalid method name for method44_4'
end
# Check predicate methods
if not Naming::MyClass.instance_methods.include?('predicate_method?')
raise RuntimeError, 'Invalid method name for predicate_method?'
end
# Check bang methods
if not Naming::MyClass.instance_methods.include?('bang_method!')
raise RuntimeError, 'Invalid method name for bang_method!'
end
my_class = Naming::MyClass.new()
if my_class.method_one != 1
raise RuntimeError, "Incorrect value for method_one"
end
if my_class.method_two != 2
raise RuntimeError, "Incorrect value for method_two"
end
if my_class.method_three != 3
raise RuntimeError, "Incorrect value for method_three"
end
if my_class.method44_4 != 4
raise RuntimeError, "Incorrect value for method44_4"
end
if my_class.predicate_method? != true
raise RuntimeError, "Incorrect value for predicate_method?"
end
if my_class.bang_method! != true
raise RuntimeError, "Incorrect value for bang_method!"
end