From 1bca853889fc3bd80509fcc40e6657538ba3df58 Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 21 Jul 2015 04:28:03 +0000 Subject: test_process.rb: split a test * test/ruby/test_process.rb (test_execopts_popen): split into 3 tests, no other redirections, stdio, and other fds. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51307 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_process.rb | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test/ruby') diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 80dc3446e5..a87eef677b 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -768,6 +768,11 @@ class TestProcess < Test::Unit::TestCase IO.popen("#{RUBY} -e 'puts :foo'") {|io| assert_equal("foo\n", io.read) } assert_raise(Errno::ENOENT) { IO.popen(["echo bar"]) {} } # assuming "echo bar" command not exist. IO.popen(ECHO["baz"]) {|io| assert_equal("baz\n", io.read) } + } + end + + def test_execopts_popen_stdio + with_tmpchdir {|d| assert_raise(ArgumentError) { IO.popen([*ECHO["qux"], STDOUT=>STDOUT]) {|io| } } @@ -777,7 +782,12 @@ class TestProcess < Test::Unit::TestCase assert_raise(ArgumentError) { IO.popen([*ECHO["fuga"], STDOUT=>"out"]) {|io| } } - skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows? + } + end + + def test_execopts_popen_extra_fd + skip "inheritance of fd other than stdin,stdout and stderr is not supported" if windows? + with_tmpchdir {|d| with_pipe {|r, w| IO.popen([RUBY, '-e', 'IO.new(3, "w").puts("a"); puts "b"', 3=>w]) {|io| assert_equal("b\n", io.read) -- cgit v1.2.3