diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-10-25 16:39:12 +0900 |
---|---|---|
committer | git <svn-admin@ruby-lang.org> | 2022-10-25 07:54:40 +0000 |
commit | 114e71d06280f9c57b9859ee4405ae89a989ddb6 (patch) | |
tree | c230a311887a725542d42c15c9dd7615ffbe0910 /test | |
parent | 883d9c305f82b23fbe0ed28e9d74461cc5e13b97 (diff) |
[ruby/tmpdir] Ignore empty environment variables
Fixes https://github.com/ruby/tmpdir/pull/17
https://github.com/ruby/tmpdir/commit/a79c727a5d
Diffstat (limited to 'test')
-rw-r--r-- | test/test_tmpdir.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/test_tmpdir.rb b/test/test_tmpdir.rb index 0be2176bd9..1adb6a70b7 100644 --- a/test/test_tmpdir.rb +++ b/test/test_tmpdir.rb @@ -47,6 +47,18 @@ class TestTmpdir < Test::Unit::TestCase end end + def test_tmpdir_not_empty_parent + Dir.mktmpdir do |tmpdir| + envs = %w[TMPDIR TMP TEMP] + oldenv = envs.each_with_object({}) {|v, h| h[v] = ENV.delete(v)} + ENV[envs[0]] = "" + ENV[envs[1]] = tmpdir + assert_equal(tmpdir, Dir.tmpdir) + ensure + ENV.update(oldenv) + end + end + def test_no_homedir bug7547 = '[ruby-core:50793]' home, ENV["HOME"] = ENV["HOME"], nil |