summaryrefslogtreecommitdiff
path: root/test/ruby/ut_eof.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-10 10:29:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-10 10:29:00 +0000
commitc5d4ee4a39df0f11a6ba98a8f5f19c9b64144baa (patch)
treeb3be9eff77a0d6e335414901285f8186a8dd8510 /test/ruby/ut_eof.rb
parent62b368dc4ae950b8218097cafc9fc4591e1093de (diff)
* ext/stringio/stringio.c (strio_read): set EOF flag at short read.
[ruby-dev:22223], [ruby-dev:22224] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5162 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/ut_eof.rb')
-rw-r--r--test/ruby/ut_eof.rb49
1 files changed, 29 insertions, 20 deletions
diff --git a/test/ruby/ut_eof.rb b/test/ruby/ut_eof.rb
index efb9f77d837..d4b0b6db39c 100644
--- a/test/ruby/ut_eof.rb
+++ b/test/ruby/ut_eof.rb
@@ -6,13 +6,13 @@ module TestEOF
assert_equal("", f.read(0))
assert_equal("", f.read(0))
assert_equal("", f.read)
- assert_equal(nil, f.read(0))
- assert_equal(nil, f.read(0))
+ assert_nil(f.read(0))
+ assert_nil(f.read(0))
}
open_file("") {|f|
- assert_equal(nil, f.read(1))
- assert_equal(nil, f.read)
- assert_equal(nil, f.read(1))
+ assert_nil(f.read(1))
+ assert_nil(f.read)
+ assert_nil(f.read(1))
}
end
@@ -20,9 +20,9 @@ module TestEOF
return unless respond_to? :open_file_rw
open_file_rw("") {|f|
assert_equal("", f.read)
- assert_equal(nil, f.read)
+ assert_nil(f.read)
assert_equal(0, f.syswrite(""))
- assert_equal(nil, f.read)
+ assert_nil(f.read)
}
end
@@ -33,24 +33,33 @@ module TestEOF
assert_equal("" , f.read(0))
assert_equal("" , f.read(0))
assert_equal("", f.read)
- assert_equal(nil, f.read(0))
- assert_equal(nil, f.read(0))
+ assert_nil(f.read(0))
+ assert_nil(f.read(0))
}
open_file("a") {|f|
assert_equal("a", f.read(1))
- assert_equal(nil, f.read(1))
+ assert_nil(f.read(1))
}
open_file("a") {|f|
assert_equal("a", f.read(2))
- assert_equal(nil, f.read(1))
- assert_equal(nil, f.read)
- assert_equal(nil, f.read(1))
+ assert_nil(f.read(1))
+ assert_nil(f.read)
+ assert_nil(f.read(1))
}
open_file("a") {|f|
assert_equal("a", f.read)
- assert_equal(nil, f.read(1))
- assert_equal(nil, f.read)
- assert_equal(nil, f.read(1))
+ assert_nil(f.read(1))
+ assert_nil(f.read)
+ assert_nil(f.read(1))
+ }
+ open_file("a") {|f|
+ assert_equal("a", f.read(2))
+ assert_nil(f.read)
+ assert_nil(f.read)
+ }
+ open_file("a") {|f|
+ assert_equal("a", f.read)
+ assert_nil(f.read(0))
}
end
@@ -67,19 +76,19 @@ module TestEOF
assert_equal(10, f.pos)
assert_equal("", f.read(0))
assert_equal("", f.read)
- assert_equal(nil, f.read(0))
- assert_equal(nil, f.read)
+ assert_nil(f.read(0))
+ assert_nil(f.read)
}
end
def test_eof_1_seek
open_file_seek("a", 10) {|f|
assert_equal("", f.read)
- assert_equal(nil, f.read)
+ assert_nil(f.read)
}
open_file_seek("a", 1) {|f|
assert_equal("", f.read)
- assert_equal(nil, f.read)
+ assert_nil(f.read)
}
end
end