diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index e266f115ba..4ee05911fb 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1713,6 +1713,25 @@ End } end + def test_reopen_mode + feature7067 = '[ruby-core:47694]' + make_tempfile {|t| + open(__FILE__) do |f| + assert_nothing_raised { + f.reopen(t.path, "r") + assert_equal("foo\n", f.gets) + } + end + + open(__FILE__) do |f| + assert_nothing_raised(feature7067) { + f.reopen(t.path, File::RDONLY) + assert_equal("foo\n", f.gets) + } + end + } + end + def test_foreach a = [] IO.foreach("|" + EnvUtil.rubybin + " -e 'puts :foo; puts :bar; puts :baz'") {|x| a << x } |