ruby-changes:24592
From: nobu <ko1@a...>
Date: Mon, 6 Aug 2012 22:06:26 +0900 (JST)
Subject: [ruby-changes:24592] nobu:r36643 (trunk): test_exception.rb: use local variables
nobu 2012-08-06 22:06:16 +0900 (Mon, 06 Aug 2012) New Revision: 36643 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=36643 Log: test_exception.rb: use local variables * test/ruby/test_exception.rb (test_exception, test_else): use local variables instead unnecessary global variables. Modified files: trunk/test/ruby/test_exception.rb Index: test/ruby/test_exception.rb =================================================================== --- test/ruby/test_exception.rb (revision 36642) +++ test/ruby/test_exception.rb (revision 36643) @@ -11,12 +11,12 @@ assert(true) end - $bad = true + bad = true begin raise "this must be handled no.2" rescue - if $bad - $bad = false + if bad + bad = false retry assert(false) end @@ -24,19 +24,19 @@ assert(true) # exception in rescue clause - $string = "this must be handled no.3" + string = "this must be handled no.3" e = assert_raise(RuntimeError) do begin raise "exception in rescue clause" rescue - raise $string + raise string end assert(false) end - assert_equal($string, e.message) + assert_equal(string, e.message) # exception in ensure clause - $string = "exception in ensure clause" + string = "exception in ensure clause" e = assert_raise(RuntimeError) do begin raise "this must be handled no.4" @@ -47,39 +47,39 @@ end assert(false) end - assert_equal($string, e.message) + assert_equal(string, e.message) - $bad = true + bad = true begin begin raise "this must be handled no.5" ensure - $bad = false + bad = false end rescue end - assert(!$bad) + assert(!bad) - $bad = true + bad = true begin begin raise "this must be handled no.6" ensure - $bad = false + bad = false end rescue end - assert(!$bad) + assert(!bad) - $bad = true + bad = true while true begin break ensure - $bad = false + bad = false end end - assert(!$bad) + assert(!bad) assert(catch(:foo) { loop do -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/