summaryrefslogtreecommitdiff
path: root/test/ruby/ut_eof.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-10 08:16:14 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-10 08:16:14 +0000
commit6395c3b38de70621232102597ee24c1fd136ca1b (patch)
treea4f670542fc90a24e839ec1a058cad23da6948c7 /test/ruby/ut_eof.rb
parentd6ce2b7b2b4dfb1c1e135138714c5fac48f50a3e (diff)
* ext/stringio/stringio.c (strio_read): adjust behavior at reading
beyond EOF to IO. [ruby-dev:22205] * test/ruby/ut_eof.rb (TestEOF::Seek): test behaviors at reading beyond EOF. * test/ruby/test_file.rb, * test/stringio/test_stringio.rb: include TestEOF::Seek test case. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5158 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/ut_eof.rb')
-rw-r--r--test/ruby/ut_eof.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/ruby/ut_eof.rb b/test/ruby/ut_eof.rb
index f1ce4f71989..ffd9ba65ab6 100644
--- a/test/ruby/ut_eof.rb
+++ b/test/ruby/ut_eof.rb
@@ -53,4 +53,31 @@ module TestEOF
assert_equal(nil, f.read(1))
}
end
+
+ module Seek
+ def open_file_seek(content, pos)
+ open_file(content) do |f|
+ f.seek(pos)
+ yield f
+ end
+ end
+
+ def test_eof_0_seek
+ open_file_seek("", 10) {|f|
+ assert_equal("", f.read)
+ assert_equal(nil, f.read)
+ }
+ end
+
+ def test_eof_1_seek
+ open_file_seek("a", 10) {|f|
+ assert_equal("", f.read)
+ assert_equal(nil, f.read)
+ }
+ open_file_seek("a", 1) {|f|
+ assert_equal("", f.read)
+ assert_equal(nil, f.read)
+ }
+ end
+ end
end