diff options
author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-18 13:21:10 +0000 |
---|---|---|
committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-18 13:21:10 +0000 |
commit | 688ec3f8ee114b8c9f477788dd7855355ee11494 (patch) | |
tree | bd12f37e20054f075d348f0b672c580dd45c6835 /test/strscan | |
parent | ebd48363c5b45a5ded4e8c9e8c69bd03fb0eec27 (diff) |
* test/*: should not depend on $KCODE.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@5765 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/strscan')
-rw-r--r-- | test/strscan/test_stringscanner.rb | 44 |
1 files changed, 28 insertions, 16 deletions
diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb index b9f7f7ddae..72961efd68 100644 --- a/test/strscan/test_stringscanner.rb +++ b/test/strscan/test_stringscanner.rb @@ -240,11 +240,15 @@ class TestStringScanner < Test::Unit::TestCase assert_equal true, s.getch.tainted? assert_nil s.getch - $KCODE = 'EUC' - s = StringScanner.new("\244\242") - assert_equal "\244\242", s.getch - assert_nil s.getch - $KCODE = 'NONE' + kc_backup = $KCODE + begin + $KCODE = 'EUC' + s = StringScanner.new("\244\242") + assert_equal "\244\242", s.getch + assert_nil s.getch + ensure + $KCODE = kc_backup + end s = StringScanner.new('test') s.scan(/te/) @@ -270,12 +274,16 @@ class TestStringScanner < Test::Unit::TestCase assert_equal true, s.get_byte.tainted? assert_nil s.get_byte - $KCODE = 'EUC' - s = StringScanner.new("\244\242") - assert_equal "\244", s.get_byte - assert_equal "\242", s.get_byte - assert_nil s.get_byte - $KCODE = 'NONE' + kc_backup = $KCODE + begin + $KCODE = 'EUC' + s = StringScanner.new("\244\242") + assert_equal "\244", s.get_byte + assert_equal "\242", s.get_byte + assert_nil s.get_byte + ensure + $KCODE = kc_backup + end s = StringScanner.new('test') s.scan(/te/) @@ -368,11 +376,15 @@ class TestStringScanner < Test::Unit::TestCase assert_nil s[0] - $KCODE = 'EUC' - s = StringScanner.new("\244\242") - s.getch - assert_equal "\244\242", s[0] - $KCODE = 'NONE' + kc_backup = $KCODE + begin + $KCODE = 'EUC' + s = StringScanner.new("\244\242") + s.getch + assert_equal "\244\242", s[0] + ensure + $KCODE = kc_backup + end str = 'test' |