Bug #7232 ยป patch.diff
| ext/stringio/stringio.c | ||
|---|---|---|
| case 2: | ||
| if (!NIL_P(str)) StringValue(str); | ||
| limit = NUM2LONG(lim); | ||
| if (!NIL_P(lim)) limit = NUM2LONG(lim); | ||
| break; | ||
| } | ||
| test/stringio/test_stringio.rb | ||
|---|---|---|
| assert_equal("abc\n\ndef\n", StringIO.new("abc\n\ndef\n").gets(nil)) | ||
| assert_equal("abc\n\n", StringIO.new("abc\n\ndef\n").gets("")) | ||
| assert_raise(TypeError){StringIO.new("").gets(1, 1)} | ||
| assert_raise(TypeError){StringIO.new("").gets(nil, nil)} | ||
| assert_nothing_raised {StringIO.new("").gets(nil, nil)} | ||
| end | ||
| def test_readlines | ||