diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_super.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/ruby/test_super.rb b/test/ruby/test_super.rb index 98cf43b7a1..1aab553ebb 100644 --- a/test/ruby/test_super.rb +++ b/test/ruby/test_super.rb @@ -385,4 +385,27 @@ class TestSuper < Test::Unit::TestCase def test_super_in_BEGIN assert_super_in_block("BEGIN") end + + class X + def foo(*args) + args + end + end + + class Y < X + define_method(:foo) do |*args| + super(*args) + end + end + + def test_super_splat + # [ruby-list:49575] + y = Y.new + assert_equal([1, 2], y.foo(1, 2)) + assert_equal([1, false], y.foo(1, false)) + assert_equal([1, 2, 3, 4, 5], y.foo(1, 2, 3, 4, 5)) + assert_equal([false, true], y.foo(false, true)) + assert_equal([false, false], y.foo(false, false)) + assert_equal([1, 2, 3, false, 5], y.foo(1, 2, 3, false, 5)) + end end |