summaryrefslogtreecommitdiffstats
path: root/test/stringio
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-28 01:08:24 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-09-28 01:08:24 +0000
commitcf4ff3f16618a19179d7e9977c86ff1faa7dd799 (patch)
tree38998aa03ebd66fb1c972b342ce9af27fd540cc2 /test/stringio
parentbe2369803a5686fa476fda6c8397f0397ae0accf (diff)
downloadruby-cf4ff3f16618a19179d7e9977c86ff1faa7dd799.tar.gz
ruby-cf4ff3f16618a19179d7e9977c86ff1faa7dd799.tar.xz
ruby-cf4ff3f16618a19179d7e9977c86ff1faa7dd799.zip
* stringio/stringio.c (strio_read): set ASCII-8BIT encoding
when length argument is given. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@25127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/stringio')
-rw-r--r--test/stringio/test_stringio.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index df292e8a8..212315ae1 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -382,9 +382,12 @@ class TestStringIO < Test::Unit::TestCase
end
def test_read
- f = StringIO.new("1234")
+ f = StringIO.new("\u3042\u3044")
assert_raise(ArgumentError) { f.read(-1) }
assert_raise(ArgumentError) { f.read(1, 2, 3) }
+ assert_equal("\u3042\u3044", f.read)
+ f.rewind
+ assert_equal("\u3042\u3044".force_encoding(Encoding::ASCII_8BIT), f.read(f.size))
end
def test_size