Skip to content

Commit 69cc535

Browse files
committed
add tests
1 parent 07e0b8a commit 69cc535

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

test/precompile.jl

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1858,6 +1858,38 @@ precompile_test_harness("Issue #50538") do load_path
18581858
@test !isdefined(I50538, :undefglobal)
18591859
end
18601860

1861+
# check that precompilation workload restores initial state of DEPOT_PATH etc.
1862+
precompile_test_harness("check DEPOT_PATH etc are restored") do load_path
1863+
write(joinpath(load_path, "modify_depot_path.jl"),
1864+
"""
1865+
module Modify_DEPOT_PATH
1866+
empty!(DEPOT_PATH)
1867+
end
1868+
""")
1869+
@test Base.compilecache(Base.PkgId("Modify_DEPOT_PATH")) isa ErrorException
1870+
write(joinpath(load_path, "modify_load_path.jl"),
1871+
"""
1872+
module Modify_LOAD_PATH
1873+
empty!(LOAD_PATH)
1874+
end
1875+
""")
1876+
@test Base.compilecache(Base.PkgId("Modify_LOAD_PATH")) isa ErrorException
1877+
write(joinpath(load_path, "modify_env.jl"),
1878+
"""
1879+
module Modify_ENV
1880+
ENV["modify_ENV"] = true
1881+
end
1882+
""")
1883+
@test Base.compilecache(Base.PkgId("Modify_ENV")) isa ErrorException
1884+
write(joinpath(load_path, "modify_active_project.jl"),
1885+
"""
1886+
module Modify_active_project
1887+
Base.set_active_project!(mktempdir())
1888+
end
1889+
""")
1890+
@test Base.compilecache(Base.PkgId("Modify_active_project")) isa ErrorException
1891+
end
1892+
18611893
empty!(Base.DEPOT_PATH)
18621894
append!(Base.DEPOT_PATH, original_depot_path)
18631895
empty!(Base.LOAD_PATH)

0 commit comments

Comments
 (0)