git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2010-01-13 17:00:48 +00:00
Родитель aac3a6bd97
Коммит 55a4c972df
1 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -260,6 +260,24 @@ class TestProcess < Test::Unit::TestCase
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