@@ -92,7 +92,7 @@ def test_gets_chomp
92
92
assert_equal ( "a" , StringIO . new ( "a" ) . gets ( chomp : true ) )
93
93
assert_equal ( "a" , StringIO . new ( "a\n b" ) . gets ( chomp : true ) )
94
94
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 ) )
96
96
assert_equal ( "abc\n " , StringIO . new ( "abc\n \n def\n " ) . gets ( "" , chomp : true ) )
97
97
stringio = StringIO . new ( "abc\n \n def\n " )
98
98
assert_equal ( "abc\n " , stringio . gets ( "" , chomp : true ) )
@@ -109,7 +109,7 @@ def test_gets_chomp_eol
109
109
assert_equal ( "a" , StringIO . new ( "a" ) . gets ( chomp : true ) )
110
110
assert_equal ( "a" , StringIO . new ( "a\r \n b" ) . gets ( chomp : true ) )
111
111
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 ) )
113
113
assert_equal ( "abc\r \n " , StringIO . new ( "abc\r \n \r \n def\r \n " ) . gets ( "" , chomp : true ) )
114
114
stringio = StringIO . new ( "abc\r \n \r \n def\r \n " )
115
115
assert_equal ( "abc\r \n " , stringio . gets ( "" , chomp : true ) )
@@ -605,6 +605,9 @@ def test_each
605
605
assert_equal ( [ "foo\r \n bar\r \n \r \n " , "baz\r \n " ] , f . each ( "" ) . to_a )
606
606
f . rewind
607
607
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 )
608
611
end
609
612
610
613
def test_putc
0 commit comments