Branch: refs/heads/master Home: https://github.com/MacRuby/MacRuby Commit: ee40af55c8a98b97ea54e406361985d9aa962c18 https://github.com/MacRuby/MacRuby/commit/ee40af55c8a98b97ea54e406361985d9aa... Author: Watson <watson1978@gmail.com> Date: 2011-05-14 (Sat, 14 May 2011) Changed paths: M io.c Log Message: ----------- IO#gets (and family) will return the string whose newline of head was cut off when passed empty string as separator. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions r, w = IO.pipe w.write "\n\n\n\n\nfoo\n\nbar\n\n\nbaz" w.close assert_equal("\n\n", r.gets("\n\n")) assert_equal("foo\n\n", r.gets("")) assert_equal("bar\n\n", r.gets("")) assert_equal("baz", r.gets("", 10)) puts :ok }}} Commit: 8067b8c2f250118e12a1b9429648a0be98bcd5aa https://github.com/MacRuby/MacRuby/commit/8067b8c2f250118e12a1b9429648a0be98... Author: Watson <watson1978@gmail.com> Date: 2011-05-14 (Sat, 14 May 2011) Changed paths: M io.c Log Message: ----------- IO#lines will yield the string when given a block. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions r, w = IO.pipe w.puts "foo\n\nbar\nbaz" w.close assert_kind_of(Enumerator, r.lines) ary = [] r.lines do |line| ary << line end assert_equal(["foo\n", "\n", "bar\n", "baz\n"], ary) puts :ok }}} Commit: f5d241e7ef3e1b39fb2507723f772eac3c79bc8d https://github.com/MacRuby/MacRuby/commit/f5d241e7ef3e1b39fb2507723f772eac3c... Author: Watson <watson1978@gmail.com> Date: 2011-05-14 (Sat, 14 May 2011) Changed paths: M io.c Log Message: ----------- IO#bytes will yield the byte data when given a block. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions r, w = IO.pipe w.puts "foo\nbar" w.close assert_kind_of(Enumerator, r.bytes) ary = [] r.bytes do |c| ary << c end assert_equal([102, 111, 111, 10, 98, 97, 114, 10], ary) puts :ok }}} Commit: c11b342411b7238474f4ee9b958191c179df1856 https://github.com/MacRuby/MacRuby/commit/c11b342411b7238474f4ee9b958191c179... Author: Watson <watson1978@gmail.com> Date: 2011-05-14 (Sat, 14 May 2011) Changed paths: M io.c Log Message: ----------- IO#chars will yield the character when given a block. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions r, w = IO.pipe w.puts "foo\nbar" w.close assert_kind_of(Enumerator, r.chars) ary = [] r.chars do |c| ary << c end assert_equal(["f", "o", "o", "\n", "b", "a", "r", "\n"], ary) puts :ok }}} Commit: acfe5bc03b8908661a760d087b50ef6f4718790c https://github.com/MacRuby/MacRuby/commit/acfe5bc03b8908661a760d087b50ef6f47... Author: Watson <watson1978@gmail.com> Date: 2011-05-14 (Sat, 14 May 2011) Changed paths: M io.c Log Message: ----------- IO.open should close a descriptor when given a block, even if raise a exception inside block. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions fd = IO.sysopen("/tmp/foo", "w") io = nil begin IO.open(fd) {|f| io = f raise } rescue assert_equal(true, io.closed?) end puts :ok }}} Commit: 8d7fdfe51daf0896f4f3e8c698a4592245f5313c https://github.com/MacRuby/MacRuby/commit/8d7fdfe51daf0896f4f3e8c698a4592245... Author: Watson <watson1978@gmail.com> Date: 2011-05-14 (Sat, 14 May 2011) Changed paths: M io.c Log Message: ----------- IO.popen should close a descriptor when given a block, even if raise a exception inside block. Test Script: {{{ require 'test/unit/assertions.rb' include Test::Unit::Assertions io = nil begin IO.popen("ruby -v", "r") {|f| io = f raise } rescue assert_equal(true, io.closed?) end puts :ok }}} Compare: https://github.com/MacRuby/MacRuby/compare/981b6c7...8d7fdfe