mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* stringio/stringio.c (strio_read): set ASCII-8BIT encoding
when length argument is given. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25127 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ea229a855f
commit
b07650769e
3 changed files with 12 additions and 4 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue