[macruby-changes] [MacRuby/MacRuby] bec0df: IO.pipe will support a block.

noreply at github.com noreply at github.com
Wed May 4 09:30:18 PDT 2011


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

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

Changed paths:
  M io.c

Log Message:
-----------
IO.pipe will support a block.

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

class SubIO < IO; end

x = nil
ret = SubIO.pipe {|r, w|
  x = [r,w]
  assert_instance_of(SubIO, r)
  assert_instance_of(SubIO, w)

  Thread.start do
    w.print "abc"
    w.close
  end
  assert_equal("abc", r.read)

  assert(!r.closed?)
  assert(w.closed?)
  :foooo
}
assert_equal(:foooo, ret)
assert(x[0].closed?)
assert(x[1].closed?)

puts :ok
}}}




More information about the macruby-changes mailing list