[macruby-changes] [MacRuby/MacRuby] d6bbfe: fix a bug of IO.readlines (and family) which is br...

noreply at github.com noreply at github.com
Thu May 12 21:35:30 PDT 2011


Branch: refs/heads/master
Home:   https://github.com/MacRuby/MacRuby

Commit: d6bbfe30f5f640965e42fb8065116a386dda7be7
    https://github.com/MacRuby/MacRuby/commit/d6bbfe30f5f640965e42fb8065116a386dda7be7
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-12 (Thu, 12 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
fix a bug of IO.readlines (and family) which is broken when was passed argument of separator and limit.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

File.open("/tmp/foo", "w") {|f|
  f.puts "foo"
  f.puts "bar"
}

ary = IO.readlines("/tmp/foo", "\n", 10)
assert_equal(["foo\n", "bar\n"], ary)

puts :ok
}}}


Commit: ccb885dd3dcef02deda6bcc9480acbc07719c34a
    https://github.com/MacRuby/MacRuby/commit/ccb885dd3dcef02deda6bcc9480acbc07719c34a
Author: Watson <watson1978 at gmail.com>
Date:   2011-05-12 (Thu, 12 May 2011)

Changed paths:
  M io.c

Log Message:
-----------
IO.readlines (and family) will accept an Object which has a to_str method as separator.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

File.open("/tmp/foo", "w") {|f|
  f.puts "foo"
  f.puts "bar"
}

sep = Object.new
def sep.to_str; "\n"; end

ary = IO.readlines("/tmp/foo", sep, 10)
assert_equal(["foo\n", "bar\n"], ary)

puts :ok
}}}


Compare: https://github.com/MacRuby/MacRuby/compare/327228c...ccb885d


More information about the macruby-changes mailing list