1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[ruby/tmpdir] Warnings should contain the environment variable name

This commit is contained in:
Nobuyoshi Nakada 2022-10-26 21:20:17 +09:00 committed by git
parent 792dc553f1
commit cb80ee7a4a

View file

@ -23,14 +23,14 @@ class TestTmpdir < Test::Unit::TestCase
ENV[e] = tmpdirx ENV[e] = tmpdirx
assert_not_equal(tmpdirx, assert_warn('') {Dir.tmpdir}) assert_not_equal(tmpdirx, assert_warn('') {Dir.tmpdir})
File.write(tmpdirx, "") File.write(tmpdirx, "")
assert_not_equal(tmpdirx, assert_warn(/not a directory/) {Dir.tmpdir}) assert_not_equal(tmpdirx, assert_warn(/\A#{e} is not a directory/) {Dir.tmpdir})
File.unlink(tmpdirx) File.unlink(tmpdirx)
ENV[e] = tmpdir ENV[e] = tmpdir
assert_equal(tmpdir, Dir.tmpdir) assert_equal(tmpdir, Dir.tmpdir)
File.chmod(0555, tmpdir) File.chmod(0555, tmpdir)
assert_not_equal(tmpdir, assert_warn(/not writable/) {Dir.tmpdir}) assert_not_equal(tmpdir, assert_warn(/\A#{e} is not writable/) {Dir.tmpdir})
File.chmod(0777, tmpdir) File.chmod(0777, tmpdir)
assert_not_equal(tmpdir, assert_warn(/world-writable/) {Dir.tmpdir}) assert_not_equal(tmpdir, assert_warn(/\A#{e} is world-writable/) {Dir.tmpdir})
newdir = Dir.mktmpdir("d", tmpdir) do |dir| newdir = Dir.mktmpdir("d", tmpdir) do |dir|
assert_file.directory? dir assert_file.directory? dir
assert_equal(tmpdir, File.dirname(dir)) assert_equal(tmpdir, File.dirname(dir))