mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
@@ -141,6 +141,10 @@ class IO
|
||||
seek(i, SEEK_SET)
|
||||
end
|
||||
|
||||
def rewind
|
||||
seek(0, SEEK_SET)
|
||||
end
|
||||
|
||||
def seek(i, whence = SEEK_SET)
|
||||
raise IOError if closed?
|
||||
@pos = sysseek(i, whence)
|
||||
|
||||
+11
@@ -256,6 +256,17 @@ assert('IO#pos=, IO#seek') do
|
||||
io.closed?
|
||||
end
|
||||
|
||||
assert('IO#rewind') do
|
||||
fd = IO.sysopen $mrbtest_io_rfname
|
||||
io = IO.new fd
|
||||
assert_equal 'm', io.getc
|
||||
assert_equal 1, io.pos
|
||||
assert_equal 0, io.rewind
|
||||
assert_equal 0, io.pos
|
||||
io.close
|
||||
io.closed?
|
||||
end
|
||||
|
||||
assert('IO#gets') do
|
||||
fd = IO.sysopen $mrbtest_io_rfname
|
||||
io = IO.new fd
|
||||
|
||||
Reference in New Issue
Block a user