[macruby-changes] [MacRuby/MacRuby] af05b3: IO#dup will copy a file path.

noreply at github.com noreply at github.com
Mon May 30 01:31:58 PDT 2011


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

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

Changed paths:
  M io.c

Log Message:
-----------
IO#dup will copy a file path.

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

io = STDOUT.dup
assert_equal("#<IO:<STDOUT>>", io.inspect)

io = File.open("/tmp/foo", "w")
io2 = io.dup
assert_equal("#<File:/tmp/foo>", io2.inspect)
io.close

r, w = IO.pipe
io = r.dup
assert_match(/#<IO:fd \d+>/, io.inspect)

f = File.open("/tmp/foo", "w")
w.reopen(f)
assert_equal("/tmp/foo", w.path)

puts :ok
}}}




More information about the macruby-changes mailing list