mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
support IO#<<
This commit is contained in:
@@ -108,6 +108,11 @@ class IO
|
||||
raise IOError
|
||||
end
|
||||
|
||||
def <<(str)
|
||||
write(str)
|
||||
self
|
||||
end
|
||||
|
||||
def eof?
|
||||
return true if @buf && @buf.size > 0
|
||||
|
||||
|
||||
@@ -150,6 +150,14 @@ assert('IO#write', '15.2.20.5.20') do
|
||||
true
|
||||
end
|
||||
|
||||
assert('IO#<<') do
|
||||
io = IO.open(IO.sysopen($mrbtest_io_wfname))
|
||||
io << "" << ""
|
||||
assert_equal 0, io.pos
|
||||
io.close
|
||||
true
|
||||
end
|
||||
|
||||
assert('IO.for_fd') do
|
||||
fd = IO.sysopen($mrbtest_io_rfname)
|
||||
io = IO.for_fd(fd)
|
||||
|
||||
Reference in New Issue
Block a user