aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_yield.rb
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-21 08:37:46 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-21 08:37:46 +0000
commit416aa4591859f20ba4c86a139c4855f1c8ea56f1 (patch)
tree958dd9b80694c6e2fdc2078d7735c5dd72a38142 /test/ruby/test_yield.rb
parente5ffa438f2475e70b7f53e56a0207970f56eb059 (diff)
downloadruby-416aa4591859f20ba4c86a139c4855f1c8ea56f1.tar.gz
* vm_insnhelper.c (vm_invoke_block): we should not expect ci->argc is
stable after invoking a block. [Bug #11451] * test/ruby/test_yield.rb: add a test. This test script is given by Alex Dowad. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_yield.rb')
-rw-r--r--test/ruby/test_yield.rb24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/ruby/test_yield.rb b/test/ruby/test_yield.rb
index a24666b6ca..e7d150a08f 100644
--- a/test/ruby/test_yield.rb
+++ b/test/ruby/test_yield.rb
@@ -401,4 +401,28 @@ class TestRubyYieldGen < Test::Unit::TestCase
end
assert_equal [m, nil], y.s(m){|a,b|[a,b]}
end
+
+ def test_block_cached_argc
+ # [Bug #11451]
+ assert_separately([], <<-"end;")
+ class Yielder
+ def each
+ yield :x, :y, :z
+ end
+ end
+ class Getter1
+ include Enumerable
+ def each(&block)
+ Yielder.new.each(&block)
+ end
+ end
+ class Getter2
+ include Enumerable
+ def each
+ Yielder.new.each { |a, b, c, d| yield(a) }
+ end
+ end
+ Getter1.new.map{Getter2.new.each{|x|}}
+ end;
+ end
end