ruby-changes:14481
From: akr <ko1@a...>
Date: Thu, 14 Jan 2010 02:00:58 +0900 (JST)
Subject: [ruby-changes:14481] Ruby:r26318 (trunk): add tests.
akr 2010-01-14 02:00:48 +0900 (Thu, 14 Jan 2010) New Revision: 26318 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=26318 Log: add tests. Modified files: trunk/test/ruby/test_process.rb Index: test/ruby/test_process.rb =================================================================== --- test/ruby/test_process.rb (revision 26317) +++ test/ruby/test_process.rb (revision 26318) @@ -260,6 +260,24 @@ system({"fofo"=>"haha"}, *ENVCOMMAND, STDOUT=>"out") assert_match(/^fofo=haha$/, File.read("out").chomp) } + + old = ENV["hmm"] + begin + ENV["hmm"] = "fufu" + IO.popen(ENVCOMMAND) {|io| assert_match(/^hmm=fufu$/, io.read) } + IO.popen([{"hmm"=>""}, *ENVCOMMAND]) {|io| assert_match(/^hmm=$/, io.read) } + IO.popen([{"hmm"=>nil}, *ENVCOMMAND]) {|io| assert_not_match(/^hmm=/, io.read) } + ENV["hmm"] = "" + IO.popen(ENVCOMMAND) {|io| assert_match(/^hmm=$/, io.read) } + IO.popen([{"hmm"=>""}, *ENVCOMMAND]) {|io| assert_match(/^hmm=$/, io.read) } + IO.popen([{"hmm"=>nil}, *ENVCOMMAND]) {|io| assert_not_match(/^hmm=/, io.read) } + ENV["hmm"] = nil + IO.popen(ENVCOMMAND) {|io| assert_not_match(/^hmm=/, io.read) } + IO.popen([{"hmm"=>""}, *ENVCOMMAND]) {|io| assert_match(/^hmm=$/, io.read) } + IO.popen([{"hmm"=>nil}, *ENVCOMMAND]) {|io| assert_not_match(/^hmm=/, io.read) } + ensure + ENV["hmm"] = old + end end def test_execopts_unsetenv_others -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/