[macruby-changes] [MacRuby/MacRuby] 53eefd: IO.for_fd raises an Errno::EINVAL if passed mode i...

GitHub noreply at github.com
Tue Feb 14 06:33:03 PST 2012


  Branch: refs/heads/master
  Home:   https://github.com/MacRuby/MacRuby
  Commit: 53eefd3a5bd0dcf30e0e1cabab869a29a37aa0e5
      https://github.com/MacRuby/MacRuby/commit/53eefd3a5bd0dcf30e0e1cabab869a29a37aa0e5
  Author: Watson <watson1978 at gmail.com>
  Date:   2012-02-14 (Tue, 14 Feb 2012)

  Changed paths:
    M io.c

  Log Message:
  -----------
  IO.for_fd raises an Errno::EINVAL if passed mode is not compatible with fd's current mode

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

fd = IO.sysopen("/tmp/aaa.txt", "w")
assert_raise(Errno::EINVAL){ io = IO.for_fd(fd, "r") }

fd = IO.sysopen("/tmp/aaa.txt", "w")
assert_raise(Errno::EINVAL){ io = IO.for_fd(fd, "w+") }

fd = IO.sysopen("/tmp/aaa.txt", "w")
assert_nothing_raised{ io = IO.for_fd(fd, "a") }





More information about the macruby-changes mailing list