diff options
| author | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-18 13:08:08 +0000 |
|---|---|---|
| committer | nahi <nahi@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-02-18 13:08:08 +0000 |
| commit | 6f65f52a94f6fa1ec995758e517e1ebf87f6ba97 (patch) | |
| tree | 23838d872b2934afececd0def03b7e06d9db6cfe /test/strscan | |
| parent | 66e294c29fc728b9c17107df2cbd0c4e0a4a5c77 (diff) | |
| download | ruby-6f65f52a94f6fa1ec995758e517e1ebf87f6ba97.tar.gz ruby-6f65f52a94f6fa1ec995758e517e1ebf87f6ba97.tar.xz ruby-6f65f52a94f6fa1ec995758e517e1ebf87f6ba97.zip | |
* test/*: should not depend on $KCODE.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@5764 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 b9f7f7dda..72961efd6 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' |
