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
  • Loading branch information
DilumAluthge committed Nov 9, 2021
1 parent 7e85914 commit c24eeb6
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 @@ -106,13 +106,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 c24eeb6

Please sign in to comment.