open the path instead of tempfile object

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2015-07-29 04:10:19 +00:00
parent 6ef6757e46
commit 9ca6e62229

View File

@ -3232,21 +3232,21 @@ End
def test_open_flag
make_tempfile do |t|
assert_raise(Errno::EEXIST){ open(t, File::WRONLY|File::CREAT, flags: File::EXCL){} }
assert_raise(Errno::EEXIST){ open(t, 'w', flags: File::EXCL){} }
assert_raise(Errno::EEXIST){ open(t, mode: 'w', flags: File::EXCL){} }
assert_raise(Errno::EEXIST){ open(t.path, File::WRONLY|File::CREAT, flags: File::EXCL){} }
assert_raise(Errno::EEXIST){ open(t.path, 'w', flags: File::EXCL){} }
assert_raise(Errno::EEXIST){ open(t.path, mode: 'w', flags: File::EXCL){} }
end
end
def test_open_flag_binar
make_tempfile do |t|
open(t, File::RDONLY, flags: File::BINARY) do |f|
open(t.path, File::RDONLY, flags: File::BINARY) do |f|
assert_equal true, f.binmode
end
open(t, 'r', flags: File::BINARY) do |f|
open(t.path, 'r', flags: File::BINARY) do |f|
assert_equal true, f.binmode
end
open(t, mode: 'r', flags: File::BINARY) do |f|
open(t.path, mode: 'r', flags: File::BINARY) do |f|
assert_equal true, f.binmode
end
end