[macruby-changes] [MacRuby/MacRuby] 5912f7: IO.new will be able to decide an access mode from ...

noreply at github.com noreply at github.com
Thu May 5 00:20:04 PDT 2011


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

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

Changed paths:
  M io.c

Log Message:
-----------
IO.new will be able to decide an access mode from a given descriptor.

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

fd = IO.sysopen("/tmp/test.txt", "w", 0666)

f = IO.new(fd)
f.write("foo\nbar\nbaz")
f.close

File.open("/tmp/test.txt") {|f|
  assert_equal("foo\nbar\nbaz", f.read)
}

assert_raise(Errno::EBADF){ IO.new(-1) }
assert_raise(Errno::EBADF){ IO.new(32767) }

puts :ok
}}}




More information about the macruby-changes mailing list