Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Registry consistency tests: In Compat.toml, make sure that each compat spec is a valid registry compat spec #575

Merged
merged 1 commit into from
Oct 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/registry_testing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
compatfile = abspath(data["path"], "Compat.toml")
if isfile(compatfile)
compat = Pkg.TOML.parsefile(compatfile)

# Test that all names with compat is a dependency
compatnames = Set{String}(x for (_, d) in compat for (x, _) in d)
if !(
Expand All @@ -223,6 +224,18 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
)
end
end

# Make sure that each compat spec is a valid registry compat spec.
# https://github.com/JuliaRegistries/General/issues/104849
for (versionrange, compatinfo) in pairs(compat)
Test.@test Pkg.Types.VersionRange(versionrange) isa Pkg.Types.VersionRange
for (name, spec_unparsed) in pairs(compatinfo)
spec = Pkg.Types.VersionSpec(spec_unparsed)
# Make sure that the compat spec is a valid registry compat spec:
Test.@test spec isa Pkg.Types.VersionSpec
end
end

# Test that the way Pkg loads this data works
Test.@test load_compat(compatfile, vnums)
# Make sure the content roundtrips through decompression/compression.
Expand Down
Loading