@@ -92,7 +92,7 @@ def test_gets_chomp
9292 assert_equal ( "a" , StringIO . new ( "a" ) . gets ( chomp : true ) )
9393 assert_equal ( "a" , StringIO . new ( "a\n b" ) . gets ( chomp : true ) )
9494 assert_equal ( "abc" , StringIO . new ( "abc\n \n def\n " ) . gets ( chomp : true ) )
95- assert_equal ( "abc\n \n def" , StringIO . new ( "abc\n \n def\n " ) . gets ( nil , chomp : true ) )
95+ assert_equal ( "abc\n \n def\n " , StringIO . new ( "abc\n \n def\n " ) . gets ( nil , chomp : true ) )
9696 assert_equal ( "abc\n " , StringIO . new ( "abc\n \n def\n " ) . gets ( "" , chomp : true ) )
9797 stringio = StringIO . new ( "abc\n \n def\n " )
9898 assert_equal ( "abc\n " , stringio . gets ( "" , chomp : true ) )
@@ -109,7 +109,7 @@ def test_gets_chomp_eol
109109 assert_equal ( "a" , StringIO . new ( "a" ) . gets ( chomp : true ) )
110110 assert_equal ( "a" , StringIO . new ( "a\r \n b" ) . gets ( chomp : true ) )
111111 assert_equal ( "abc" , StringIO . new ( "abc\r \n \r \n def\r \n " ) . gets ( chomp : true ) )
112- assert_equal ( "abc\r \n \r \n def" , StringIO . new ( "abc\r \n \r \n def\r \n " ) . gets ( nil , chomp : true ) )
112+ assert_equal ( "abc\r \n \r \n def\r \n " , StringIO . new ( "abc\r \n \r \n def\r \n " ) . gets ( nil , chomp : true ) )
113113 assert_equal ( "abc\r \n " , StringIO . new ( "abc\r \n \r \n def\r \n " ) . gets ( "" , chomp : true ) )
114114 stringio = StringIO . new ( "abc\r \n \r \n def\r \n " )
115115 assert_equal ( "abc\r \n " , stringio . gets ( "" , chomp : true ) )
@@ -605,6 +605,9 @@ def test_each
605605 assert_equal ( [ "foo\r \n bar\r \n \r \n " , "baz\r \n " ] , f . each ( "" ) . to_a )
606606 f . rewind
607607 assert_equal ( [ "foo\r \n bar\r \n " , "baz" ] , f . each ( "" , chomp : true ) . to_a )
608+
609+ f = StringIO . new ( "abc\n \n def\n " )
610+ assert_equal ( [ "ab" , "c\n " , "\n d" , "ef" , "\n " ] , f . each ( nil , 2 , chomp : true ) . to_a )
608611 end
609612
610613 def test_putc
0 commit comments