diff options
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_process.rb | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index b47c1e46a9..67d946317d 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -536,6 +536,28 @@ class TestProcess < Test::Unit::TestCase } end + def test_execopts_redirect_open_order_normal + minfd = 3 + maxfd = 20 + with_tmpchdir {|d| + opts = {} + minfd.upto(maxfd) {|fd| opts[fd] = ["out#{fd}", "w"] } + system RUBY, "-e", "#{minfd}.upto(#{maxfd}) {|fd| IO.new(fd).print fd.to_s }", opts + minfd.upto(maxfd) {|fd| assert_equal(fd.to_s, File.read("out#{fd}")) } + } + end + + def test_execopts_redirect_open_order_reverse + minfd = 3 + maxfd = 20 + with_tmpchdir {|d| + opts = {} + maxfd.downto(minfd) {|fd| opts[fd] = ["out#{fd}", "w"] } + system RUBY, "-e", "#{minfd}.upto(#{maxfd}) {|fd| IO.new(fd).print fd.to_s }", opts + minfd.upto(maxfd) {|fd| assert_equal(fd.to_s, File.read("out#{fd}")) } + } + end + def test_execopts_redirect_pipe with_pipe {|r1, w1| with_pipe {|r2, w2| |