From 3c05f1a44514cf5ddf362ded986ae7632bdb2a9d Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Wed, 10 Aug 2022 09:48:34 -0400 Subject: [PATCH 1/3] Registry consistency tests: the compress roundtrip check should compare `VersionRange`s (not `String`s) --- Project.toml | 2 +- src/registry_testing.jl | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Project.toml b/Project.toml index 90bca45b..f06fc58b 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "RegistryCI" uuid = "0c95cc5f-2f7e-43fe-82dd-79dbcba86b32" authors = ["Dilum Aluthge ", "Fredrik Ekre ", "contributors"] -version = "7.4.0" +version = "7.5.0" [deps] Base64 = "2a0f44e3-6c83-55bd-87e4-b1978d98bd5f" diff --git a/src/registry_testing.jl b/src/registry_testing.jl index 8090a3b8..9c762e79 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -218,11 +218,16 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) end # Test that the way Pkg loads this data works Test.@test load_compat(compatfile, vnums) - # Make sure the content roundtrips through decompression/compression + # Make sure the content roundtrips through decompression/compression. + # However, before we check for equality, we change the compat ranges + # from `String`s to `VersionRanges`. compressed = RegistryTools.Compress.compress( compatfile, RegistryTools.Compress.load(compatfile) ) - Test.@test compressed == compat + mapdict = (f, dict) -> Dict(f(k, v) for (k, v) in pairs(dict)) + f_inner = (k, v) -> (k, Pkg.Types.VersionRange.(v)) + f_outer = (k, dict) -> (k, mapdict(f_inner, dict)) + Test.@test mapdict(f_outer, compressed) == mapdict(f_outer, compat) end end # Make sure all paths are unique From 736053d1131520bddfcfab2ad4616d9aa1df940c Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Wed, 10 Aug 2022 16:51:51 -0400 Subject: [PATCH 2/3] Iterate directly over the dict (i.e. replace `for (k, v) in pairs(dict)` with `for (k, v) in dict`) --- src/registry_testing.jl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index 9c762e79..f05f109d 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -224,7 +224,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) compressed = RegistryTools.Compress.compress( compatfile, RegistryTools.Compress.load(compatfile) ) - mapdict = (f, dict) -> Dict(f(k, v) for (k, v) in pairs(dict)) + mapdict = (f, dict) -> Dict(f(k, v) for (k, v) in dict) f_inner = (k, v) -> (k, Pkg.Types.VersionRange.(v)) f_outer = (k, dict) -> (k, mapdict(f_inner, dict)) Test.@test mapdict(f_outer, compressed) == mapdict(f_outer, compat) From 88f772c24199a75665b30a75dd549556b9121fd3 Mon Sep 17 00:00:00 2001 From: Dilum Aluthge Date: Thu, 11 Aug 2022 20:10:47 -0400 Subject: [PATCH 3/3] Map over only the values of the dictionaries --- src/registry_testing.jl | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/registry_testing.jl b/src/registry_testing.jl index f05f109d..8b88c13d 100644 --- a/src/registry_testing.jl +++ b/src/registry_testing.jl @@ -224,10 +224,10 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[]) compressed = RegistryTools.Compress.compress( compatfile, RegistryTools.Compress.load(compatfile) ) - mapdict = (f, dict) -> Dict(f(k, v) for (k, v) in dict) - f_inner = (k, v) -> (k, Pkg.Types.VersionRange.(v)) - f_outer = (k, dict) -> (k, mapdict(f_inner, dict)) - Test.@test mapdict(f_outer, compressed) == mapdict(f_outer, compat) + mapvalues = (f, dict) -> Dict(k => f(v) for (k, v) in dict) + f_inner = v -> Pkg.Types.VersionRange.(v) + f_outer = dict -> mapvalues(f_inner, dict) + Test.@test mapvalues(f_outer, compressed) == mapvalues(f_outer, compat) end end # Make sure all paths are unique