mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/ruby/test_array.rb (TestArray#test_splat): Add test cases
where splat fails in when clause. ref [Bug #2468] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26589 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
40c3b2f112
commit
0759512a5b
2 changed files with 45 additions and 0 deletions
|
@ -1284,4 +1284,44 @@ class TestArray < Test::Unit::TestCase
|
|||
a = [2,3]
|
||||
assert_equal([2,3], [*a], bug2401)
|
||||
end
|
||||
|
||||
def test_splat_when
|
||||
assert_equal(true,
|
||||
case 2
|
||||
when 1, 2, 3
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
)
|
||||
|
||||
assert_equal(true,
|
||||
case 2
|
||||
when *[1, 2, 3]
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
)
|
||||
|
||||
a = [1, 2, 3]
|
||||
assert_equal(true,
|
||||
case 2
|
||||
when 1, *a
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
)
|
||||
|
||||
a = [1, 2, 3]
|
||||
assert_equal(true,
|
||||
case 2
|
||||
when *a
|
||||
true
|
||||
else
|
||||
false
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue