diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-12 12:14:06 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-12 12:14:06 +0000 |
commit | 6ecedf07a53963077e30b431870f89a27c8204e3 (patch) | |
tree | 42ae729411217b1c36b51ef06cf5d66a81c21cf8 /test/ruby | |
parent | b95647f8df29b2a05f3d4082319cf09a3051fc24 (diff) | |
download | ruby-6ecedf07a53963077e30b431870f89a27c8204e3.tar.gz |
* file.c (File::SHARE_DELETE): new flag to be able to delete opened file
on Windows.
* include/win32/win32.c (O_SHARE_DELETE): new pseudo file mode flag.
* win32/win32.c (rb_w32_{w,}open): support above flag. [EXPERIMENTAL]
* NEWS: mention about this feature.
[Feature #11218] [ruby-dev:49022]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50848 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_file.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_file.rb b/test/ruby/test_file.rb index 601d19efcd..c4fed73f48 100644 --- a/test/ruby/test_file.rb +++ b/test/ruby/test_file.rb @@ -375,6 +375,19 @@ class TestFile < Test::Unit::TestCase } end + def test_file_share_delete + Dir.mktmpdir(__method__.to_s) do |tmpdir| + tmp = File.join(tmpdir, 'x') + File.open(tmp, mode: IO::WRONLY | IO::CREAT | IO::BINARY | IO::SHARE_DELETE) do |f| + assert_file.exist?(tmp) + assert_nothing_raised do + File.unlink(tmp) + end + end + assert_file.not_exist?(tmp) + end + end + def test_conflicting_encodings Dir.mktmpdir(__method__.to_s) do |tmpdir| tmp = File.join(tmpdir, 'x') |