Commit ff90bb1c authored by yui-knk's avatar yui-knk

Refactoring exception test.

Change to use assert_equal explicitly.
parent f0be02fc
...@@ -57,15 +57,16 @@ end ...@@ -57,15 +57,16 @@ end
# Not ISO specified # Not ISO specified
assert('Exception 1') do assert('Exception 1') do
begin r=begin
1+1 1+1
ensure ensure
2+2 2+2
end == 2 end
assert_equal 2, r
end end
assert('Exception 2') do assert('Exception 2') do
begin r=begin
1+1 1+1
begin begin
2+2 2+2
...@@ -74,11 +75,12 @@ assert('Exception 2') do ...@@ -74,11 +75,12 @@ assert('Exception 2') do
end end
ensure ensure
4+4 4+4
end == 4 end
assert_equal 4, r
end end
assert('Exception 3') do assert('Exception 3') do
begin r=begin
1+1 1+1
begin begin
2+2 2+2
...@@ -92,7 +94,8 @@ assert('Exception 3') do ...@@ -92,7 +94,8 @@ assert('Exception 3') do
ensure ensure
6+6 6+6
end end
end == 4 end
assert_equal 4, r
end end
assert('Exception 4') do assert('Exception 4') do
...@@ -171,17 +174,18 @@ assert('Exception 7') do ...@@ -171,17 +174,18 @@ assert('Exception 7') do
end end
assert('Exception 8') do assert('Exception 8') do
begin r=begin
1 1
rescue rescue
2 2
else else
3 3
end == 3 end
assert_equal 3, r
end end
assert('Exception 9') do assert('Exception 9') do
begin r=begin
1+1 1+1
rescue rescue
2+2 2+2
...@@ -189,11 +193,12 @@ assert('Exception 9') do ...@@ -189,11 +193,12 @@ assert('Exception 9') do
3+3 3+3
ensure ensure
4+4 4+4
end == 6 end
assert_equal 6, r
end end
assert('Exception 10') do assert('Exception 10') do
begin r=begin
1+1 1+1
begin begin
2+2 2+2
...@@ -208,7 +213,8 @@ assert('Exception 10') do ...@@ -208,7 +213,8 @@ assert('Exception 10') do
6+6 6+6
ensure ensure
7+7 7+7
end == 12 end
assert_equal 12, r
end end
assert('Exception 11') do assert('Exception 11') do
...@@ -273,12 +279,12 @@ assert('Exception 16') do ...@@ -273,12 +279,12 @@ assert('Exception 16') do
raise "foo" raise "foo"
false false
rescue => e rescue => e
e.message == "foo" assert_equal "foo", e.message
end end
end end
assert('Exception 17') do assert('Exception 17') do
begin r=begin
raise "a" # StandardError raise "a" # StandardError
rescue ArgumentError rescue ArgumentError
1 1
...@@ -288,11 +294,12 @@ assert('Exception 17') do ...@@ -288,11 +294,12 @@ assert('Exception 17') do
3 3
ensure ensure
4 4
end == 2 end
assert_equal 2, r
end end
assert('Exception 18') do assert('Exception 18') do
begin r=begin
0 0
rescue ArgumentError rescue ArgumentError
1 1
...@@ -302,7 +309,8 @@ assert('Exception 18') do ...@@ -302,7 +309,8 @@ assert('Exception 18') do
3 3
ensure ensure
4 4
end == 3 end
assert_equal 3, r
end end
assert('Exception 19') do assert('Exception 19') do
......
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