Skip to content

Commit

Permalink
file tests: in the "tempname with parent" test, temporarily unset…
Browse files Browse the repository at this point in the history
… the `TMPDIR` environment variable while running the test (JuliaLang#43012)

(cherry picked from commit ac2ee4d)
  • Loading branch information
DilumAluthge authored and daviehh committed Nov 16, 2021
1 parent 89e2f75 commit af4708d
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions test/file.jl
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,15 @@ using Random
end

@testset "tempname with parent" begin
t = tempname()
@test dirname(t) == tempdir()
mktempdir() do d
t = tempname(d)
@test dirname(t) == d
withenv("TMPDIR" => nothing) do
t = tempname()
@test dirname(t) == tempdir()
mktempdir() do d
t = tempname(d)
@test dirname(t) == d
end
@test_throws ArgumentError tempname(randstring())
end
@test_throws ArgumentError tempname(randstring())
end

child_eval(code::String) = eval(Meta.parse(readchomp(`$(Base.julia_cmd()) -E $code`)))
Expand Down

0 comments on commit af4708d

Please sign in to comment.