diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-29 01:39:14 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-29 01:39:14 +0000 |
commit | b5a648837cfc52f01fb77cd471a0c434340de044 (patch) | |
tree | 009888bcde4ac2ba8f29ea5218bd5e74c8d8dfc2 /test | |
parent | 0643fa9af6dd5bb91191c21d79d7a604d3c66a1e (diff) | |
download | ruby-b5a648837cfc52f01fb77cd471a0c434340de044.tar.gz |
* io.c (rb_io_extract_modeenc): add option parameter `flags'
to append extra oflags to normal mode.
[Feature #11253] [ruby-core:69539]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 51b67f37f5..7adeae4700 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -3230,4 +3230,25 @@ End } end if /mswin|mingw|bccwin/ !~ RUBY_PLATFORM + 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){} } + end + end + + def test_open_flag_binar + make_tempfile do |t| + open(t, File::RDONLY, flags: File::BINARY) do |f| + assert_equal true, f.binmode + end + open(t, 'r', flags: File::BINARY) do |f| + assert_equal true, f.binmode + end + open(t, mode: 'r', flags: File::BINARY) do |f| + assert_equal true, f.binmode + end + end + end if File::BINARY != 0 end |