mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/stringio/stringio.c (strio_read): follow IO#read.
* test/ruby/ut_eof.rb, test/ruby/test_file.rb, test/ruby/test_pipe.rb, test/stringio/test_stringio.rb: add EOF test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5115 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e3ed269193
commit
7fbf13f7f2
8 changed files with 93 additions and 14 deletions
|
@ -1,15 +1,14 @@
|
|||
require 'test/unit'
|
||||
require 'stringio'
|
||||
dir = File.expand_path(__FILE__)
|
||||
2.times {dir = File.dirname(dir)}
|
||||
$:.replace([File.join(dir, "ruby")] | $:)
|
||||
require 'ut_eof'
|
||||
|
||||
class TestStringIO < Test::Unit::TestCase
|
||||
def test_empty_file
|
||||
f = StringIO.new("")
|
||||
assert_equal("", f.read(0))
|
||||
assert_equal("", f.read)
|
||||
assert_equal(nil, f.read(0))
|
||||
f = StringIO.new("")
|
||||
assert_equal(nil, f.read(1))
|
||||
assert_equal(nil, f.read)
|
||||
assert_equal(nil, f.read(1))
|
||||
include TestEOF
|
||||
def open_file(content)
|
||||
f = StringIO.new(content)
|
||||
yield f
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue