diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-14 07:03:39 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-11-14 07:03:39 +0000 |
commit | 326659c0bfdd9adc1f4a032ced0374dbb6a7bcc8 (patch) | |
tree | 68ed27390893d3c37e86b1d434e699110ed53dce | |
parent | e81b38e3782d280c1577b78b35f8a1c5cd217a3f (diff) | |
download | ruby-326659c0bfdd9adc1f4a032ced0374dbb6a7bcc8.tar.gz |
* test/socket/test_socket.rb: update not to use 1.8 assignment to
external local variable in the block parameters. [ruby-dev:32251]
* test/strscan/test_stringscanner.rb: avoid $KCODE, and use
String#force_encoding(). [ruby-dev:32251]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@13922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | test/socket/test_socket.rb | 9 | ||||
-rw-r--r-- | test/strscan/test_stringscanner.rb | 39 |
3 files changed, 24 insertions, 32 deletions
@@ -1,3 +1,11 @@ +Wed Nov 14 15:39:24 2007 Yukihiro Matsumoto <matz@ruby-lang.org> + + * test/socket/test_socket.rb: update not to use 1.8 assignment to + external local variable in the block parameters. [ruby-dev:32251] + + * test/strscan/test_stringscanner.rb: avoid $KCODE, and use + String#force_encoding(). [ruby-dev:32251] + Wed Nov 14 14:04:42 2007 Tanaka Akira <akr@fsij.org> * common.mk, Makefile.in: rename prelude.c to miniprelude.c. diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 2eba8a1cb0..78e678c96f 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -38,7 +38,8 @@ class TestBasicSocket < Test::Unit::TestCase s.close linger } - inet_stream do |s| + inet_stream do |sock| + s = sock assert_equal(0, s.setsockopt(Socket::SOL_SOCKET, Socket::SO_LINGER, linger)) assert_raise(IOError) { @@ -51,7 +52,8 @@ class TestBasicSocket < Test::Unit::TestCase s.close Socket::SO_LINGER } - inet_stream do |s| + inet_stream do |sock| + s = sock assert_raise(IOError) { s.setsockopt(Socket::SOL_SOCKET, val, linger) } @@ -65,7 +67,8 @@ class TestBasicSocket < Test::Unit::TestCase s.close 2 } - inet_stream do |s| + inet_stream do |sock| + s = sock assert_raise(IOError) { s.listen(log) } diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb index 5b0fd53c75..c918368435 100644 --- a/test/strscan/test_stringscanner.rb +++ b/test/strscan/test_stringscanner.rb @@ -288,15 +288,9 @@ class TestStringScanner < Test::Unit::TestCase assert_equal true, s.getch.tainted? assert_nil s.getch - 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("\244\242".force_encoding("euc-jp")) + assert_equal "\244\242", s.getch + assert_nil s.getch s = StringScanner.new('test') s.scan(/te/) @@ -322,16 +316,10 @@ class TestStringScanner < Test::Unit::TestCase assert_equal true, s.get_byte.tainted? assert_nil s.get_byte - 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("\244\242".force_encoding("euc-jp")) + assert_equal "\244", s.get_byte + assert_equal "\242", s.get_byte + assert_nil s.get_byte s = StringScanner.new('test') s.scan(/te/) @@ -424,16 +412,9 @@ class TestStringScanner < Test::Unit::TestCase assert_nil s[0] - kc_backup = $KCODE - begin - $KCODE = 'EUC' - s = StringScanner.new("\244\242") - s.getch - assert_equal "\244\242", s[0] - ensure - $KCODE = kc_backup - end - + s = StringScanner.new("\244\242".force_encoding("euc-jp")) + s.getch + assert_equal "\244\242", s[0] str = 'test' str.taint |