1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_io.rb: split test_gets_rs

* test/ruby/test_io.rb (test_gets_rs): split for each record
  separators.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56359 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-10-06 03:53:34 +00:00
parent 631f8da938
commit 0fe40d4bb8

View file

@ -146,7 +146,19 @@ class TestIO < Test::Unit::TestCase
end end
def test_gets_rs def test_gets_rs
# default_rs rs = ":"
pipe(proc do |w|
w.print "aaa:bbb"
w.close
end, proc do |r|
assert_equal "aaa:", r.gets(rs)
assert_equal "bbb", r.gets(rs)
assert_nil r.gets(rs)
r.close
end)
end
def test_gets_default_rs
pipe(proc do |w| pipe(proc do |w|
w.print "aaa\nbbb\n" w.print "aaa\nbbb\n"
w.close w.close
@ -156,8 +168,9 @@ class TestIO < Test::Unit::TestCase
assert_nil r.gets assert_nil r.gets
r.close r.close
end) end)
end
# nil def test_gets_rs_nil
pipe(proc do |w| pipe(proc do |w|
w.print "a\n\nb\n\n" w.print "a\n\nb\n\n"
w.close w.close
@ -166,8 +179,9 @@ class TestIO < Test::Unit::TestCase
assert_nil r.gets("") assert_nil r.gets("")
r.close r.close
end) end)
end
# "\377" def test_gets_rs_377
pipe(proc do |w| pipe(proc do |w|
w.print "\377xyz" w.print "\377xyz"
w.close w.close
@ -176,8 +190,9 @@ class TestIO < Test::Unit::TestCase
assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]") assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]")
r.close r.close
end) end)
end
# "" def test_gets_paragraph
pipe(proc do |w| pipe(proc do |w|
w.print "a\n\nb\n\n" w.print "a\n\nb\n\n"
w.close w.close