From cf4ff3f16618a19179d7e9977c86ff1faa7dd799 Mon Sep 17 00:00:00 2001 From: naruse Date: Mon, 28 Sep 2009 01:08:24 +0000 Subject: * 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 --- test/stringio/test_stringio.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'test/stringio') 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 -- cgit