summaryrefslogtreecommitdiff
path: root/test/ruby/ut_eof.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-24 05:23:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-24 05:23:32 +0000
commit6fe8d987ce2296174dcd3e4f3c382f8114728210 (patch)
tree2ec4e1c67c58d3f4851b3bb15902034afcbfb8e5 /test/ruby/ut_eof.rb
parent73d77c8f572b760b4c868579188fc39f360151cb (diff)
* ext/stringio/stringio.c (strio_read): clear the buffer argument
when returning nil. [ruby-dev:22363] * test/ruby/ut_eof.rb (TestEOF::test_eof_0, TestEOF::test_eof_1): add buffer argument tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/ut_eof.rb')
-rw-r--r--test/ruby/ut_eof.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/ut_eof.rb b/test/ruby/ut_eof.rb
index 8b3cc8101b..eff0bddc0b 100644
--- a/test/ruby/ut_eof.rb
+++ b/test/ruby/ut_eof.rb
@@ -14,6 +14,16 @@ module TestEOF
assert_equal("", f.read)
assert_nil(f.read(1))
}
+ open_file("") {|f|
+ s = "x"
+ assert_equal("", f.read(nil, s))
+ assert_equal("", s)
+ }
+ open_file("") {|f|
+ s = "x"
+ assert_nil(f.read(10, s))
+ assert_equal("", s)
+ }
end
def test_eof_0_rw
@@ -61,6 +71,16 @@ module TestEOF
assert_equal("a", f.read)
assert_nil(f.read(0))
}
+ open_file("a") {|f|
+ s = "x"
+ assert_equal("a", f.read(nil, s))
+ assert_equal("a", s)
+ }
+ open_file("a") {|f|
+ s = "x"
+ assert_equal("a", f.read(10, s))
+ assert_equal("a", s)
+ }
end
module Seek