mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* insns.def (splatarray): make new array if flag is set.
* compile.c (iseq_compile_each): make new array with splat. [ruby-core:21901][Feature #1125] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34633 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e315f8471d
commit
fde3c421be
4 changed files with 17 additions and 2 deletions
|
@ -632,7 +632,7 @@ class TestBasicInstructions < Test::Unit::TestCase
|
|||
assert_equal 'i', $~[9]
|
||||
assert_equal 'x', $`
|
||||
assert_equal 'abcdefghi', $&
|
||||
assert_equal 'y', $'
|
||||
assert_equal "y", $'
|
||||
assert_equal 'i', $+
|
||||
assert_equal 'a', $1
|
||||
assert_equal 'b', $2
|
||||
|
@ -662,15 +662,20 @@ class TestBasicInstructions < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_array_splat
|
||||
feature1125 = '[ruby-core:21901]'
|
||||
|
||||
a = []
|
||||
assert_equal [], [*a]
|
||||
assert_equal [1], [1, *a]
|
||||
assert_not_same(a, [*a], feature1125)
|
||||
a = [2]
|
||||
assert_equal [2], [*a]
|
||||
assert_equal [1, 2], [1, *a]
|
||||
assert_not_same(a, [*a], feature1125)
|
||||
a = [2, 3]
|
||||
assert_equal [2, 3], [*a]
|
||||
assert_equal [1, 2, 3], [1, *a]
|
||||
assert_not_same(a, [*a], feature1125)
|
||||
|
||||
a = nil
|
||||
assert_equal [], [*a]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue