Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
IanButterworth committed Aug 16, 2021
1 parent 97691b6 commit 237105a
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
35 changes: 35 additions & 0 deletions test/new.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
#
Expand Down
9 changes: 9 additions & 0 deletions test/repl.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit 237105a

Please sign in to comment.