From 600601c338006d9701ce3a8ee9922cdc47d9fed8 Mon Sep 17 00:00:00 2001 From: nobu Date: Thu, 5 Aug 2010 11:30:50 +0000 Subject: * compile.c (iseq_compile_each): to_a method should be called. [Bug #3658] * compile.c (iseq_compile_each): ditto for ARGSPUSH. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@28873 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_primitive.rb | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'test/ruby/test_primitive.rb') diff --git a/test/ruby/test_primitive.rb b/test/ruby/test_primitive.rb index e87028c860..448349fcbb 100644 --- a/test/ruby/test_primitive.rb +++ b/test/ruby/test_primitive.rb @@ -405,5 +405,20 @@ class TestRubyPrimitive < Test::Unit::TestCase bug3658 = '[ruby-dev:41933]' [0, *x=1] assert_equal(1, x, bug3658) + [0, *x=1, 2] + assert_equal(1, x, bug3658) + class << (x = Object.new) + attr_accessor :to_a_called + def to_a + @to_a_called = true + [self] + end + end + x.to_a_called = false + [0, *x] + assert(x.to_a_called, bug3658) + x.to_a_called = false + [0, *x, 2] + assert(x.to_a_called, bug3658) end end -- cgit v1.2.3