From 237105a601cec839263246753e7914bd3ac3b85d Mon Sep 17 00:00:00 2001 From: Ian Date: Sun, 15 Aug 2021 23:54:58 -0400 Subject: [PATCH] add tests --- test/new.jl | 35 +++++++++++++++++++++++++++++++++++ test/repl.jl | 9 +++++++++ 2 files changed, 44 insertions(+) diff --git a/test/new.jl b/test/new.jl index 5f5793f206..adf90d5d3d 100644 --- a/test/new.jl +++ b/test/new.jl @@ -2164,6 +2164,41 @@ end end end +# +# # compat +# +@testset "Pkg.compat" begin + # State changes + isolate(loaded_depot=true) do + Pkg.add("Example") + iob = IOBuffer() + Pkg.compat(io = iob) + output = String(take!(iob)) + @test occursin(r"Compat `.+Project.toml`", output) + @test occursin(r"\[7876af07\] *Example *none", output) + @test occursin(r"julia *none", output) + + Pkg.compat!("Example", "0.2,0.3") + @test Pkg.compat("Example") == "0.2,0.3" + Pkg.compat(io = iob) + output = String(take!(iob)) + @test occursin(r"Compat `.+Project.toml`", output) + @test occursin(r"\[7876af07\] *Example *0.2,0.3", output) + @test occursin(r"julia *none", output) + + Pkg.compat!("Example", nothing) + Pkg.compat!("julia", "1.8") + @test Pkg.compat("Example") == nothing + @test Pkg.compat("julia") == "1.8" + Pkg.compat(io = iob) + output = String(take!(iob)) + @test occursin(r"Compat `.+Project.toml`", output) + @test occursin(r"\[7876af07\] *Example *none", output) + @test occursin(r"julia *1.8", output) + end +end + + # # # Caching # diff --git a/test/repl.jl b/test/repl.jl index 466d3310dc..8367b0c627 100644 --- a/test/repl.jl +++ b/test/repl.jl @@ -645,6 +645,15 @@ end end end +@testset "compat" begin + temp_pkg_dir() do project_path + pkg""" + add Example Random + compat + """ + end +end + @testset "subcommands" begin temp_pkg_dir() do project_path; cd_tempdir() do tmpdir; with_temp_env() do Pkg.REPLMode.pkg"package add Example"