From b1ffb3b3b8a555a876be04922a7868b923d55839 Mon Sep 17 00:00:00 2001 From: h2so5 Date: Tue, 16 Apr 2013 16:03:36 +0900 Subject: Add Proc#arity --- test/t/proc.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test') 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 } -- cgit v1.2.3