From ddabdd44271e9e693232143e5ef84da74f470e7c Mon Sep 17 00:00:00 2001 From: nobu Date: Mon, 6 Aug 2012 13:06:16 +0000 Subject: test_exception.rb: use local variables * test/ruby/test_exception.rb (test_exception, test_else): use local variables instead unnecessary global variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36643 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_exception.rb | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 11c1f6af67..90289e4d54 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -11,12 +11,12 @@ class TestException < Test::Unit::TestCase 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 @@ class TestException < Test::Unit::TestCase 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 @@ class TestException < Test::Unit::TestCase 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 -- cgit v1.2.3