mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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:
parent
adc782762b
commit
54420c2614
2 changed files with 21 additions and 0 deletions
|
@ -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.
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue