* test/ruby/test_super.rb: add tests.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
usa 2007-05-10 06:17:07 +00:00
parent adc782762b
commit 54420c2614
2 changed files with 21 additions and 0 deletions

View File

@ -1,3 +1,7 @@
Thu May 10 15:15:53 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* test/ruby/test_super.rb: add tests.
Thu May 10 15:14:05 2007 NAKAMURA Usaku <usa@ruby-lang.org>
* ext/iconv/iconv.c (iconv_s_conv): rdoc fix.

View File

@ -43,6 +43,12 @@ class TestSuper < Test::Unit::TestCase
class Optional3 < Base
def single(a = 1) super end
end
class Optional4 < Base
def array(a = 1, *) super end
end
class Optional5 < Base
def array(a = 1, b = 2, *) super end
end
def test_single1
assert_equal(1, Single1.new.single(1))
@ -94,6 +100,17 @@ class TestSuper < Test::Unit::TestCase
# call Base#single with 1 argument; the arg is supplied
assert_equal(1, Optional3.new.single)
end
def test_optional4
assert_equal([1], Optional4.new.array)
assert_equal([9], Optional4.new.array(9))
assert_equal([9, 8], Optional4.new.array(9, 8))
end
def test_optional5
assert_equal([1, 2], Optional5.new.array)
assert_equal([9, 2], Optional5.new.array(9))
assert_equal([9, 8], Optional5.new.array(9, 8))
assert_equal([9, 8, 7], Optional5.new.array(9, 8, 7))
end
class A
def tt(aa)