summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-06 03:53:34 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-10-06 03:53:34 +0000
commit0fe40d4bb87f475e8100771856b8a046e7c17265 (patch)
treedf0fb80bca2628160679322eb9e0f170d54d448f /test
parent631f8da938cbe0551af2f1af52d8663eda1ea0d7 (diff)
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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb23
1 files changed, 19 insertions, 4 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 99ccf7e9d6..c188f2cda3 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -146,7 +146,19 @@ class TestIO < Test::Unit::TestCase
end
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|
w.print "aaa\nbbb\n"
w.close
@@ -156,8 +168,9 @@ class TestIO < Test::Unit::TestCase
assert_nil r.gets
r.close
end)
+ end
- # nil
+ def test_gets_rs_nil
pipe(proc do |w|
w.print "a\n\nb\n\n"
w.close
@@ -166,8 +179,9 @@ class TestIO < Test::Unit::TestCase
assert_nil r.gets("")
r.close
end)
+ end
- # "\377"
+ def test_gets_rs_377
pipe(proc do |w|
w.print "\377xyz"
w.close
@@ -176,8 +190,9 @@ class TestIO < Test::Unit::TestCase
assert_equal("\377", r.gets("\377"), "[ruby-dev:24460]")
r.close
end)
+ end
- # ""
+ def test_gets_paragraph
pipe(proc do |w|
w.print "a\n\nb\n\n"
w.close