ruby-changes:24593
From: nobu <ko1@a...>
Date: Mon, 6 Aug 2012 22:06:54 +0900 (JST)
Subject: [ruby-changes:24593] nobu:r36644 (trunk): test_exception.rb: split tests
nobu 2012-08-06 22:06:37 +0900 (Mon, 06 Aug 2012) New Revision: 36644 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36644 Log: test_exception.rb: split tests * test/ruby/test_exception.rb (test_exception, test_else): split huge tests into simple tests. Modified files: trunk/test/ruby/test_exception.rb Index: test/ruby/test_exception.rb =================================================================== --- test/ruby/test_exception.rb (revision 36643) +++ test/ruby/test_exception.rb (revision 36644) @@ -3,14 +3,16 @@ require_relative 'envutil' class TestException < Test::Unit::TestCase - def test_exception + def test_exception_rescued begin raise "this must be handled" assert(false) rescue assert(true) end + end + def test_exception_retry bad = true begin raise "this must be handled no.2" @@ -22,8 +24,9 @@ end end assert(true) + end - # exception in rescue clause + def test_exception_in_rescue string = "this must be handled no.3" e = assert_raise(RuntimeError) do begin @@ -34,8 +37,9 @@ assert(false) end assert_equal(string, e.message) + end - # exception in ensure clause + def test_exception_in_ensure string = "exception in ensure clause" e = assert_raise(RuntimeError) do begin @@ -48,7 +52,9 @@ assert(false) end assert_equal(string, e.message) + end + def test_exception_ensure bad = true begin begin @@ -59,7 +65,9 @@ rescue end assert(!bad) + end + def test_exception_ensure_2 # just duplication? bad = true begin begin @@ -70,7 +78,9 @@ rescue end assert(!bad) + end + def test_break_ensure bad = true while true begin @@ -80,7 +90,9 @@ end end assert(!bad) + end + def test_catch_throw assert(catch(:foo) { loop do loop do @@ -95,7 +107,7 @@ end - def test_else + def test_else_no_exception begin assert(true) rescue @@ -103,7 +115,9 @@ else assert(true) end + end + def test_else_raised begin assert(true) raise @@ -113,7 +127,9 @@ else assert(false) end + end + def test_else_nested_no_exception begin assert(true) begin @@ -129,7 +145,9 @@ else assert(true) end + end + def test_else_nested_rescued begin assert(true) begin @@ -147,7 +165,9 @@ else assert(true) end + end + def test_else_nested_unrescued begin assert(true) begin @@ -165,7 +185,9 @@ else assert(false) end + end + def test_else_nested_rescued_reraise begin assert(true) begin -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/