Commit c26f998e authored by takahashim's avatar takahashim

support IO#<<

parent 6c4d3941
...@@ -108,6 +108,11 @@ class IO ...@@ -108,6 +108,11 @@ class IO
raise IOError raise IOError
end end
def <<(str)
write(str)
self
end
def eof? def eof?
return true if @buf && @buf.size > 0 return true if @buf && @buf.size > 0
......
...@@ -150,6 +150,14 @@ assert('IO#write', '15.2.20.5.20') do ...@@ -150,6 +150,14 @@ assert('IO#write', '15.2.20.5.20') do
true true
end 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 assert('IO.for_fd') do
fd = IO.sysopen($mrbtest_io_rfname) fd = IO.sysopen($mrbtest_io_rfname)
io = IO.for_fd(fd) io = IO.for_fd(fd)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment