summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-17 23:22:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-05-17 23:22:28 +0000
commit831202f85c7b42ba90fa00ca23e714815d666b39 (patch)
treea4191927060e62afc4311bc85d86fcffce27b48e /test/ruby
parente279eca4bdf1e4364308aee2ca504bbdf2b5d221 (diff)
io.c: buffer must be modifiable
* io.c (io_setstrbuf): always check if the buffer is modifiable. [ruby-core:62643] [Bug #9847] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45979 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 5ed2ddd13b..9d89772d99 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2839,25 +2839,24 @@ End
def assert_buffer_not_raise_shared_string_error
bug6764 = '[ruby-core:46586]'
+ bug9847 = '[ruby-core:62643] [Bug #9847]'
size = 28
data = [*"a".."z", *"A".."Z"].shuffle.join("")
t = Tempfile.new("test_io")
t.write(data)
t.close
- w = Tempfile.new("test_io")
+ w = []
assert_nothing_raised(RuntimeError, bug6764) do
+ buf = ''
File.open(t.path, "r") do |r|
- buf = ''
while yield(r, size, buf)
- w << buf
+ w << buf.dup
end
end
end
- w.close
- assert_equal(data, w.open.read, bug6764)
+ assert_equal(data, w.join(""), bug9847)
ensure
t.close!
- w.close!
end
def test_read_buffer_not_raise_shared_string_error