Project

General

Profile

Feature #11920 ยป test-stringio-initialize.patch

ksss (Yuki Kurihara), 12/29/2015 04:46 AM

View differences:

test/stringio/test_stringio.rb
include TestEOF::Seek
def test_initialize
assert_kind_of StringIO, StringIO.new
assert_kind_of StringIO, StringIO.new('str')
assert_kind_of StringIO, StringIO.new('str', 'r+')
assert_raise(ArgumentError) { StringIO.new('', 'x') }
assert_raise(ArgumentError) { StringIO.new('', 'rx') }
assert_raise(ArgumentError) { StringIO.new('', 'rbt') }
assert_raise(TypeError) { StringIO.new(nil) }
assert_raise(TypeError) { StringIO.new('str', nil) }
o = Object.new
def o.to_str
nil
end
assert_raise(TypeError) { StringIO.new(o) }
def o.to_str
'str'
end
assert_kind_of StringIO, StringIO.new(o)
end
def test_truncate
io = StringIO.new("")
io.puts "abc"
    (1-1/1)