From 0ea1e43174a5b75682fc19789ea8dbeeb5b10ec6 Mon Sep 17 00:00:00 2001 From: nobu Date: Fri, 28 Dec 2012 02:50:57 +0000 Subject: vm_insnhelper.c: no splat single opt arg * vm_insnhelper.c (vm_yield_setup_block_args): pass single argument to single optional parameter unchanged without splatting. [Bug #7621] [ruby-dev:46801] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_proc.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'test/ruby/test_proc.rb') diff --git a/test/ruby/test_proc.rb b/test/ruby/test_proc.rb index 8d84d2d60d..f9a0beecd1 100644 --- a/test/ruby/test_proc.rb +++ b/test/ruby/test_proc.rb @@ -499,6 +499,22 @@ class TestProc < Test::Unit::TestCase assert_equal [1, 2, 3], pr.call([1,2,3,4,5,6]) end + def test_proc_args_opt_signle + bug7621 = '[ruby-dev:46801]' + pr = proc {|a=:a| + a + } + assert_equal :a, pr.call() + assert_equal 1, pr.call(1) + assert_equal 1, pr.call(1,2) + + assert_equal [], pr.call([]), bug7621 + assert_equal [1], pr.call([1]), bug7621 + assert_equal [1, 2], pr.call([1,2]), bug7621 + assert_equal [1, 2, 3], pr.call([1,2,3]), bug7621 + assert_equal [1, 2, 3, 4], pr.call([1,2,3,4]), bug7621 + end + def test_proc_args_pos_opt_post pr = proc {|a,b,c=:c,d,e| [a,b,c,d,e] -- cgit v1.2.3