mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
when limit is nil. [Bug #7232] [ruby-core:48531] * test/stringio/test_stringio.rb: a test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
22691e7f6b
commit
89182621d9
3 changed files with 10 additions and 2 deletions
|
@ -1,3 +1,11 @@
|
|||
Thu Dec 27 20:45:29 2012 Masaki Matsushita <glass.saga@gmail.com>
|
||||
|
||||
* ext/stringio/stringio.c (strio_getline): fix not to raise TypeError
|
||||
when limit is nil.
|
||||
[Bug #7232] [ruby-core:48531]
|
||||
|
||||
* test/stringio/test_stringio.rb: a test for above.
|
||||
|
||||
Thu Dec 27 21:08:23 2012 Charlie Somerville <charlie@charliesomerville.com>
|
||||
|
||||
* vm_core.h (VM_DEFINECLASS_TYPE): explicit cast to enum type to avoid 64->32
|
||||
|
|
|
@ -987,7 +987,7 @@ strio_getline(int argc, VALUE *argv, struct StringIO *ptr)
|
|||
|
||||
case 2:
|
||||
if (!NIL_P(str)) StringValue(str);
|
||||
limit = NUM2LONG(lim);
|
||||
if (!NIL_P(lim)) limit = NUM2LONG(lim);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ class TestStringIO < Test::Unit::TestCase
|
|||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue