From 0759512a5bb6d3d9e461d1f05fbc02cf2b8d7809 Mon Sep 17 00:00:00 2001 From: knu Date: Fri, 5 Feb 2010 17:09:27 +0000 Subject: * 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 --- test/ruby/test_array.rb | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'test/ruby/test_array.rb') diff --git a/test/ruby/test_array.rb b/test/ruby/test_array.rb index adac3e19d7..fe10a69e68 100644 --- a/test/ruby/test_array.rb +++ b/test/ruby/test_array.rb @@ -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 -- cgit v1.2.3