summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-28 02:50:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-12-28 02:50:57 +0000
commit0ea1e43174a5b75682fc19789ea8dbeeb5b10ec6 (patch)
tree149962c55453d9d3461181944a0663de822e0080 /test/ruby
parentd5a39c0aa85a705fcf360a535a278aed9116f644 (diff)
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
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_proc.rb16
1 files changed, 16 insertions, 0 deletions
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]