summaryrefslogtreecommitdiffhomepage
path: root/test
diff options
context:
space:
mode:
authorTomoyuki Sahara <[email protected]>2016-09-30 16:27:11 +0900
committerTomoyuki Sahara <[email protected]>2016-09-30 16:27:11 +0900
commit2229a2aa0fcd76bd5498417aca934d6ec7a211ef (patch)
treef1892774b9ce4f8d583802b748d71d94e1e7428c /test
parent51cf6b6048d7e4182d8bb8d58c7bcac07cb3064b (diff)
downloadmruby-2229a2aa0fcd76bd5498417aca934d6ec7a211ef.tar.gz
mruby-2229a2aa0fcd76bd5498417aca934d6ec7a211ef.zip
reimplement #eof. fixes #66.
Diffstat (limited to 'test')
-rw-r--r--test/io.rb25
1 files changed, 20 insertions, 5 deletions
diff --git a/test/io.rb b/test/io.rb
index 1b0a2d52e..c3f78da7e 100644
--- a/test/io.rb
+++ b/test/io.rb
@@ -70,14 +70,29 @@ end
#assert('IO#each_line', '15.2.20.5.5') do
assert('IO#eof?', '15.2.20.5.6') do
+ if false # XXX: not implemented yet
+ io = IO.new(IO.sysopen($mrbtest_io_wfname, 'w'), 'w')
+ assert_raise(IOError) do
+ io.eof?
+ end
+ end
+
+ # empty file
+ io = IO.open(IO.sysopen($mrbtest_io_wfname, 'w'), 'w')
+ io.close
+ io = IO.open(IO.sysopen($mrbtest_io_wfname, 'r'), 'r')
+ assert_true io.eof?
+ io.close
+
+ # nonempty file
io = IO.new(IO.sysopen($mrbtest_io_rfname))
- $mrbtest_io_msg.each_char { |ch|
- # XXX
- #assert_false io.eof?
- io.getc
- }
+ assert_false io.eof?
+ io.readchar
+ assert_false io.eof?
+ io.read
assert_true io.eof?
io.close
+
true
end