From 67cf354b465604d820ea51d4afcc14d681640a19 Mon Sep 17 00:00:00 2001 From: kosaki Date: Sat, 21 May 2011 13:20:43 +0000 Subject: * io.c (rb_io_extract_modeenc): accept combination hash and File::Constants. (eg. File.open('yo', :mode => File::WRONLY)) [Feature #4742][ruby-core:36338] * test/ruby/test_io.rb (TestIO#test_open_mode): new test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index de55abbd41..1ed9072c89 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1849,4 +1849,16 @@ End end rescue NotImplementedError end + + def test_open_mode + feature4742 = "[ruby-core:36338]" + + mkcdtmpdir do + refute_nil(File.open('symbolic', 'w')) + refute_nil(File.open('numeric', File::WRONLY|File::TRUNC|File::CREAT)) + refute_nil(File.open('hash-symbolic', :mode => 'w')) + refute_nil(File.open('hash-numeric', :mode => File::WRONLY|File::TRUNC|File::CREAT), feature4742) + end + end + end -- cgit v1.2.3