summaryrefslogtreecommitdiffhomepage
path: root/test/t/proc.rb
diff options
context:
space:
mode:
authorh2so5 <[email protected]>2013-04-16 16:03:36 +0900
committerh2so5 <[email protected]>2013-04-16 16:03:36 +0900
commitb1ffb3b3b8a555a876be04922a7868b923d55839 (patch)
tree67d9a78ddba7aaf5c348640b39f2778576884941 /test/t/proc.rb
parenta06e0ab33f255a54d72c0775e5d9e4047064ccb8 (diff)
downloadmruby-b1ffb3b3b8a555a876be04922a7868b923d55839.tar.gz
mruby-b1ffb3b3b8a555a876be04922a7868b923d55839.zip
Add Proc#arity
Diffstat (limited to 'test/t/proc.rb')
-rw-r--r--test/t/proc.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/t/proc.rb b/test/t/proc.rb
index c0a1cf90f..4d5e5cab4 100644
--- a/test/t/proc.rb
+++ b/test/t/proc.rb
@@ -35,6 +35,15 @@ assert('Proc#[]', '15.2.17.4.1') do
a == 1 and a2 == 5
end
+assert('Proc#arity', '15.2.17.4.2') do
+ a = Proc.new {|x, y|}.arity
+ b = Proc.new {|x, *y, z|}.arity
+ c = Proc.new {|x=0, y|}.arity
+ d = Proc.new {|(x, y), z=0|}.arity
+
+ a == 2 and b == -3 and c == 1 and d == 1
+end
+
assert('Proc#call', '15.2.17.4.3') do
a = 0
b = Proc.new { a += 1 }