[macruby-changes] [MacRuby/MacRuby] 874eb4: IO#reopen will be able to decide an access mode ev...
noreply at github.com
noreply at github.com
Thu May 12 08:39:29 PDT 2011
Branch: refs/heads/master
Home: https://github.com/MacRuby/MacRuby
Commit: 874eb42d6b5644317a1ab049fd05910139b245fe
https://github.com/MacRuby/MacRuby/commit/874eb42d6b5644317a1ab049fd05910139b245fe
Author: Watson <watson1978 at gmail.com>
Date: 2011-05-12 (Thu, 12 May 2011)
Changed paths:
M io.c
Log Message:
-----------
IO#reopen will be able to decide an access mode even if it was not passed.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
File.delete("/tmp/foo") if File.exists?("/tmp/foo")
File.delete("/tmp/bar") if File.exists?("/tmp/bar")
f = File.open("/tmp/foo", "w")
f.reopen("/tmp/bar")
f.puts "hello, world"
f.close
File.open("/tmp/bar") {|f|
assert_equal("hello, world\n", f.gets)
}
puts :ok
}}}
Commit: b5146bcf480f8a454e00dbb3ef3cd9fdef1d59c2
https://github.com/MacRuby/MacRuby/commit/b5146bcf480f8a454e00dbb3ef3cd9fdef1d59c2
Author: Watson <watson1978 at gmail.com>
Date: 2011-05-12 (Thu, 12 May 2011)
Changed paths:
M io.c
Log Message:
-----------
IO#reopen will raise an exception when can not reopen.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
File.delete("/tmp/foo") if File.exists?("/tmp/foo")
File.delete("/tmp/bar") if File.exists?("/tmp/bar")
f = File.open("/tmp/foo", "w")
assert_raise(Errno::ENOENT){ f.reopen("/tmp/bar", "r") }
puts :ok
}}}
Commit: deb722699ef72bf9b3de60d97da58a03df10a96c
https://github.com/MacRuby/MacRuby/commit/deb722699ef72bf9b3de60d97da58a03df10a96c
Author: Watson <watson1978 at gmail.com>
Date: 2011-05-12 (Thu, 12 May 2011)
Changed paths:
M io.c
Log Message:
-----------
IO#reopen with IO object will set a file path when was passed File object.
Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions
File.delete("/tmp/foo") if File.exists?("/tmp/foo")
r, w = IO.pipe
f = File.open("/tmp/foo", "w")
w.reopen(f)
assert_equal("/tmp/foo", w.path)
puts :ok
}}}
Compare: https://github.com/MacRuby/MacRuby/compare/b98b9da...deb7226
More information about the macruby-changes
mailing list