1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

test_process.rb: split

* test/ruby/test_process.rb (test_execopts_redirect): split large
  test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48770 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-12-11 04:26:30 +00:00
parent 7307c32f1f
commit 3977132bbb

View file

@ -461,7 +461,7 @@ class TestProcess < Test::Unit::TestCase
SORT = [RUBY, '-e', "puts ARGF.readlines.sort"]
CAT = [RUBY, '-e', "IO.copy_stream STDIN, STDOUT"]
def test_execopts_redirect
def test_execopts_redirect_fd
with_tmpchdir {|d|
Process.wait Process.spawn(*ECHO["a"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644])
assert_equal("a", File.read("out").chomp)
@ -533,7 +533,10 @@ class TestProcess < Test::Unit::TestCase
assert_equal("bb\naa\n", File.read("out"))
system(*SORT, STDIN=>["out"], STDOUT=>"out2")
assert_equal("aa\nbb\n", File.read("out2"))
}
end
def test_execopts_redirect_pipe
with_pipe {|r1, w1|
with_pipe {|r2, w2|
opts = {STDIN=>r1, STDOUT=>w2}
@ -602,7 +605,10 @@ class TestProcess < Test::Unit::TestCase
end
}
end
end
def test_execopts_redirect_symbol
with_tmpchdir {|d|
system(*ECHO["funya"], :out=>"out")
assert_equal("funya\n", File.read("out"))
system(RUBY, '-e', 'STDOUT.reopen(STDERR); puts "henya"', :err=>"out")