aboutsummaryrefslogtreecommitdiffstats
path: root/test/stringio
diff options
context:
space:
mode:
Diffstat (limited to 'test/stringio')
-rw-r--r--test/stringio/test_stringio.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/stringio/test_stringio.rb b/test/stringio/test_stringio.rb
index 26fcc624e2..22cba382fb 100644
--- a/test/stringio/test_stringio.rb
+++ b/test/stringio/test_stringio.rb
@@ -426,6 +426,11 @@ class TestStringIO < Test::Unit::TestCase
s = ""
f.read(nil, s)
assert_equal("\u3042\u3044", s, bug5207)
+ f.rewind
+ # not empty buffer
+ s = "0123456789"
+ f.read(nil, s)
+ assert_equal("\u3042\u3044", s)
end
def test_readpartial
@@ -435,6 +440,10 @@ class TestStringIO < Test::Unit::TestCase
assert_equal("\u3042\u3044", f.readpartial)
f.rewind
assert_equal("\u3042\u3044".force_encoding(Encoding::ASCII_8BIT), f.readpartial(f.size))
+ f.rewind
+ # not empty buffer
+ s = '0123456789'
+ assert_equal("\u3042\u3044".force_encoding(Encoding::ASCII_8BIT), f.readpartial(f.size, s))
end
def test_read_nonblock
@@ -444,6 +453,10 @@ class TestStringIO < Test::Unit::TestCase
assert_equal("\u3042\u3044", f.read_nonblock)
f.rewind
assert_equal("\u3042\u3044".force_encoding(Encoding::ASCII_8BIT), f.read_nonblock(f.size))
+ f.rewind
+ # not empty buffer
+ s = '0123456789'
+ assert_equal("\u3042\u3044".force_encoding(Encoding::ASCII_8BIT), f.read_nonblock(f.size, s))
end
def test_size