diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-13 17:00:48 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-01-13 17:00:48 +0000 |
commit | 55a4c972dffeab1589b44a9eeb69e8a17b87cd1d (patch) | |
tree | 8ed3a220e4b6c25407c82f914b8a56f556523a4f /test/ruby | |
parent | aac3a6bd97b3556d5c4e161024c3206fde978c5e (diff) | |
download | ruby-55a4c972dffeab1589b44a9eeb69e8a17b87cd1d.tar.gz |
add tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@26318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_process.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb index 3a7eb5068f..57ffdf958c 100644 --- a/test/ruby/test_process.rb +++ b/test/ruby/test_process.rb @@ -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 |