diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-06 13:06:16 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-08-06 13:06:16 +0000 |
commit | ddabdd44271e9e693232143e5ef84da74f470e7c (patch) | |
tree | 0818f65a1b6fb7cdd37d825ab583380e4f3cff9c /test | |
parent | 281e4b611f68cb5d0d6e42fa50cb491a5b54a832 (diff) | |
download | ruby-ddabdd44271e9e693232143e5ef84da74f470e7c.tar.gz |
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
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_exception.rb | 34 |
1 files 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 |