Project

General

Profile

Bug #7231 ยป patch.diff

Glass_saga (Masaki Matsushita), 12/25/2012 12:01 PM

View differences:

ext/stringio/stringio.c
rb_encoding *enc, *enc2;
if (NIL_P(c)) return Qnil;
check_modifiable(ptr);
if (FIXNUM_P(c)) {
int cc = FIX2INT(c);
char buf[16];
......
cl = RSTRING_LEN(c);
if (cl == 0) return Qnil;
}
check_modifiable(ptr);
rb_str_modify(str);
if (cl > pos) {
char *s;
test/stringio/test_stringio.rb
assert_raise(RuntimeError, bug) {s.reopen("")}
end
def test_frozen_string
s = StringIO.new("".freeze)
bug = '[ruby-core:48530]'
assert_raise(IOError, bug) {s.write("foo")}
assert_raise(IOError, bug) {s.ungetc("a")}
assert_raise(IOError, bug) {s.ungetbyte("a")}
end
def test_readlines_limit_0
assert_raise(ArgumentError, "[ruby-dev:43392]") { StringIO.new.readlines(0) }
end
    (1-1/1)