Commit 9166a135 authored by Daniel Bovensiepen's avatar Daniel Bovensiepen

Improve Proc Tests

parent e44ba316
......@@ -2,25 +2,19 @@
# Proc ISO Test
assert('Proc', '15.2.17') do
Proc.class == Class
assert_equal Proc.class, Class
end
assert('Proc superclass', '15.2.17.2') do
Proc.superclass == Object
assert_equal Proc.superclass, Object
end
assert('Proc.new', '15.2.17.3.1') do
a = nil
begin
assert_raise ArgumentError do
Proc.new
rescue => e
a = e
end
b = Proc.new {}
a.class == ArgumentError and b.class == Proc
assert_equal (Proc.new {}).class, Proc
end
assert('Proc#[]', '15.2.17.4.1') do
......@@ -32,7 +26,8 @@ assert('Proc#[]', '15.2.17.4.1') do
b2 = Proc.new { |i| a2 += i }
b2.[](5)
a == 1 and a2 == 5
assert_equal a, 1
assert_equal a2, 5
end
assert('Proc#arity', '15.2.17.4.2') do
......@@ -41,7 +36,10 @@ assert('Proc#arity', '15.2.17.4.2') do
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
assert_equal a, 2
assert_equal b, -3
assert_equal c, 1
assert_equal d, 1
end
assert('Proc#call', '15.2.17.4.3') do
......@@ -53,5 +51,6 @@ assert('Proc#call', '15.2.17.4.3') do
b2 = Proc.new { |i| a2 += i }
b2.call(5)
a == 1 and a2 == 5
assert_equal a, 1
assert_equal a2, 5
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment