summaryrefslogtreecommitdiff
path: root/test/ruby/test_primitive.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_primitive.rb')
-rw-r--r--test/ruby/test_primitive.rb15
1 files changed, 15 insertions, 0 deletions
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