[macruby-changes] [MacRuby/MacRuby] 85fe95: StringIO#{each, readlines} will raise an ArgumentE...
noreply at github.com
noreply at github.com
Sat Apr 9 08:12:41 PDT 2011
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 85fe9536b427cf0c92bf633836b604dc19c5f4a9
https://github.com/MacRuby/MacRuby/commit/85fe9536b427cf0c92bf633836b604dc19c5f4a9
Author: Watson <watson1978 at gmail.com>
Date: 2011-04-09 (Sat, 09 Apr 2011)
Changed paths:
M lib/stringio.rb
Log Message:
-----------
StringIO#{each, readlines} will raise an ArgumentError when was passed 0 to limit because limit 0 causes infinity loop.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
require 'stringio'
f = StringIO.new("foo\nbar\nbaz\n")
assert_raise(ArgumentError){ f.readlines(0) }
assert_raise(ArgumentError){ f.readlines("", 0) }
assert_raise(ArgumentError){ f.each_line(0){ } }
assert_raise(ArgumentError){ f.each_line("", 0){ } }
assert_nothing_raised{ f.each_line(0) }
obj = Object.new
def obj.to_int; 0; end
assert_raise(ArgumentError){ f.readlines(obj) }
puts :ok
}}}
More information about the macruby-changes
mailing list