diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-13 14:01:07 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-09-13 14:01:07 +0000 |
commit | 4c2f2ffc02c9a8bff5750d754c5a6e8502ae3a64 (patch) | |
tree | 607e5935272a9d8c3b51792672de8b7507f59853 /test | |
parent | a6929d1d7e276184427d861797fff8cc7e9badb6 (diff) |
merge revision(s) 42782,42799: [Backport #8902]
* vm_insnhelper.c (vm_search_super_method): use ci->argc instead of
ci->orig_argc. ci->argc can be changed by splat arguments.
[ruby-list:49575]
This fix should be applied to Ruby 2.0.0 seriese.
* test/ruby/test_super.rb: add a test for above.
* numeric.c (NUM_STEP_SCAN_ARGS): On second thought, keep
* internal.h (bit_length): Add casts to fix compilation error with
This fix should be applied to Ruby 2.0.0 series.
numeric literal, for the backward compatibility.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@42934 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 |