@@ -703,6 +703,15 @@ mktempdir() do dir
703703 @test success (cmd)
704704end
705705
706+ function _with_empty_load_path (f:: Function )
707+ old_load_path = copy (Base. LOAD_PATH )
708+ try
709+ empty! (Base. LOAD_PATH )
710+ f ()
711+ finally
712+ append! (Base. LOAD_PATH , old_load_path)
713+ end
714+ end
706715old_act_proj = Base. ACTIVE_PROJECT[]
707716function _with_activate (f:: Function , project_file:: Union{AbstractString, Nothing} )
708717 try
728737 @testset " active_manifest() - no argument passed" begin
729738 for (proj, expected_man) in test_cases
730739 @test _activate_and_get_active_manifest_noarg (proj) == expected_man
740+ # Base.active_manifest() should never return a file that doesn't exist:
741+ @test isfile_activate_and_get_active_manifest_noarg (proj))
731742 end
732743 mktempdir () do dir
733744 proj = joinpath (dir, " Project.toml" )
743754 manif = joinpath (dir, " Manifest.toml" )
744755 touch (manif)
745756 @test _activate_and_get_active_manifest_noarg (proj) == manif
757+ # Base.active_manifest() should never return a file that doesn't exist:
758+ @test isfile (_activate_and_get_active_manifest_noarg (proj))
746759
747760 # If the manifest file exists but the project file does not, active_manifest() should return `nothing`:
748761 rm (proj)
754767 Base. ACTIVE_PROJECT[] = old_act_proj
755768 for (proj, expected_man) in test_cases
756769 @test Base. active_manifest (proj) == expected_man
770+ # Base.active_manifest() should never return a file that doesn't exist:
771+ @test isfile (Base. active_manifest (proj))
757772 end
758773 mktempdir () do dir
759774 proj = joinpath (dir, " Project.toml" )
769784 manif = joinpath (dir, " Manifest.toml" )
770785 touch (manif)
771786 @test Base. active_manifest (proj) == manif
787+ # Base.active_manifest() should never return a file that doesn't exist:
788+ @test isfile (Base. active_manifest (proj))
772789
773790 # If the manifest file exists but the project file does not, active_manifest(proj) should return `nothing`:
774791 rm (proj)
@@ -777,10 +794,10 @@ end
777794 end
778795
779796 @testset " ACTIVE_PROJECT[] is `nothing` => active_manifest() is nothing" begin
780- _with_activate (nothing ) do
797+ _with_activate (nothing ) do ; _with_empty_load_path () do
781798 @test Base. active_manifest () === nothing
782799 @test Base. active_manifest (nothing ) === nothing
783- end
800+ end ; end
784801 end
785802
786803 @testset " Project file does not exist => active_manifest() is nothing" begin
0 commit comments