@@ -86,6 +86,35 @@ using ..Utils
8686 @test_logs (:warn ,) Pkg. activate (env_dir; io= io)
8787 end
8888 end
89+
90+ @testset " Pkg.upgrade_manifest()" begin
91+ env_dir = joinpath (@__DIR__ , " manifest" , " formats" , " v1.0" )
92+ env_manifest = joinpath (env_dir, " Manifest.toml" )
93+ cp (env_manifest, string (env_manifest, " _backup" ))
94+ try
95+ isfile (env_manifest) || error (" Reference manifest is missing" )
96+ if Base. is_v1_format_manifest (Base. parsed_toml (env_manifest)) == false
97+ error (" Reference manifest file at $(env_manifest) is invalid" )
98+ end
99+ isolate (loaded_depot= true ) do
100+ io = IOBuffer ()
101+ Pkg. activate (env_dir; io= io)
102+ output = String (take! (io))
103+ @test occursin (r" Activating.*project at.*`.*v1.0`" , output)
104+ @test Base. is_v1_format_manifest (Base. parsed_toml (env_manifest))
105+
106+ Pkg. upgrade_manifest ()
107+ @test Base. is_v1_format_manifest (Base. parsed_toml (env_manifest)) == false
108+ Pkg. activate (env_dir; io= io)
109+ output = String (take! (io))
110+ @test occursin (r" Activating.*project at.*`.*v1.0`" , output)
111+ @test Pkg. Types. Context (). env. manifest. manifest_format == v " 2.0.0"
112+ end
113+ finally
114+ cp (string (env_manifest, " _backup" ), env_manifest, force = true )
115+ rm (string (env_manifest, " _backup" ))
116+ end
117+ end
89118end
90119
91120
0 commit comments