IO#sysread with 0 always return empty string

This commit is contained in:
ksss
2017-05-21 22:52:52 +09:00
parent 6836f424c5
commit 844b2c368f
2 changed files with 4 additions and 0 deletions
+3
View File
@@ -625,6 +625,9 @@ mrb_io_sysread(mrb_state *mrb, mrb_value io)
if (maxlen < 0) {
return mrb_nil_value();
}
else if (maxlen == 0) {
return mrb_str_new(mrb, NULL, maxlen);
}
if (mrb_nil_p(buf)) {
buf = mrb_str_new(mrb, NULL, maxlen);
+1
View File
@@ -234,6 +234,7 @@ assert('IO.sysopen, IO#sysread') do
io.sysread(10000)
end
io.close
assert_equal "", io.sysread(0)
io.closed?
end