ruby-changes:39226
From: nobu <ko1@a...>
Date: Tue, 21 Jul 2015 13:28:23 +0900 (JST)
Subject: [ruby-changes:39226] nobu:r51307 (trunk): test_process.rb: split a test
nobu 2015-07-21 13:28:03 +0900 (Tue, 21 Jul 2015) New Revision: 51307 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=51307 Log: 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. Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 51306) +++ test/ruby/test_process.rb (revision 51307) @@ -768,6 +768,11 @@ class TestProcess < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L768 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 https://github.com/ruby/ruby/blob/trunk/test/ruby/test_process.rb#L782 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) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/