Commit 1d6b7f9b authored by Tomoyuki Sahara's avatar Tomoyuki Sahara

Merge pull request #44 from takahashim/io-addstr

support IO#<<
parents 6c4d3941 c26f998e
...@@ -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