diff options
author | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-13 15:53:27 +0000 |
---|---|---|
committer | nagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-08-13 15:53:27 +0000 |
commit | 9c03800575286a49cc034ffbf92a79937187062b (patch) | |
tree | bd2d6cdd8c7025ec45955861ae1ac141a24411c4 /test | |
parent | b76dad515e0039c27bc935ddfcbbd7474d32675a (diff) |
merge revision(s) 51066: [Backport #11319]
* io.c (rb_io_oflags_modestr): handle O_TRUNC correctly
* test/ruby/test_io.rb (test_reopen_stdio): new test
Patch-by: cremno phobia <cremno@mail.ru>
[ruby-core:69779] [Bug #11319]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 935ee24d83..d0ca5e6e51 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -2050,6 +2050,15 @@ End } end + def test_reopen_stdio + mkcdtmpdir { + fname = 'bug11319' + File.write(fname, 'hello') + system(EnvUtil.rubybin, '-e', "STDOUT.reopen('#{fname}', 'w+')") + assert_equal('', File.read(fname)) + } + end + def test_reopen_mode feature7067 = '[ruby-core:47694]' make_tempfile {|t| |