From 54420c26147321080c6664ec095471172311cf9b Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 10 May 2007 06:17:07 +0000 Subject: [PATCH] * test/ruby/test_super.rb: add tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@12270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ test/ruby/test_super.rb | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/ChangeLog b/ChangeLog index 74b05cc79f..265bf20f06 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu May 10 15:15:53 2007 NAKAMURA Usaku + + * test/ruby/test_super.rb: add tests. + Thu May 10 15:14:05 2007 NAKAMURA Usaku * ext/iconv/iconv.c (iconv_s_conv): rdoc fix. diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index cf2e241fdd..900fe997e6 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -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)