Skip to content

Commit c80fb6f

Browse files
Merge #514
514: Registry consistency tests: before doing certain equality comparisons, add whitespace before and after hyphens r=DilumAluthge a=DilumAluthge This is necessary due to JuliaLang/Pkg.jl#3580, which made it onto Julia master in JuliaLang/julia#51186. Co-authored-by: Dilum Aluthge <[email protected]>
2 parents 9957688 + 800e39c commit c80fb6f

File tree

4 files changed

+36
-5
lines changed

4 files changed

+36
-5
lines changed

Project.toml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
2424
VisualStringDistances = "089bb0c6-1854-47b9-96f7-327dbbe09dca"
2525

2626
[compat]
27-
BrokenRecord = "0.1.3"
2827
GitHub = "5.2"
2928
HTTP = "0.8, 0.9.1, 1"
3029
JSON = "0.19, 0.20, 0.21"
@@ -39,7 +38,6 @@ VisualStringDistances = "0.1"
3938
julia = "1.3"
4039

4140
[extras]
42-
BrokenRecord = "bdd55f5b-6e67-4da1-a080-6086e55655a0"
4341
Dates = "ade2ca70-3891-5945-98fb-dc099432e06a"
4442
GitHub = "bc5e4493-9b4d-5f90-b8aa-2b2bcaad7a26"
4543
JSON = "682c06a0-de6a-54ab-a142-c8b1cf79cde6"
@@ -50,4 +48,4 @@ Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
5048
TimeZones = "f269a46b-ccf7-5d73-abea-4c690281aa53"
5149

5250
[targets]
53-
test = ["BrokenRecord", "Dates", "GitHub", "JSON", "Pkg", "Printf", "SimpleMock", "Test", "TimeZones"]
51+
test = ["Dates", "GitHub", "JSON", "Pkg", "Printf", "SimpleMock", "Test", "TimeZones"]

docs/Project.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
[deps]
22
Documenter = "e30172f5-a6a5-5a46-863b-614d45cd2de4"
33
RegistryCI = "0c95cc5f-2f7e-43fe-82dd-79dbcba86b32"
4+
5+
[compat]
6+
Documenter = "< 1"

src/registry_testing.jl

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
193193
compressed = RegistryTools.Compress.compress(
194194
depsfile, RegistryTools.Compress.load(depsfile)
195195
)
196-
Test.@test compressed == deps
196+
Test.@test _spacify_hyphens(compressed) == _spacify_hyphens(deps)
197197
else
198198
@debug "Deps.toml file does not exist" depsfile
199199
end
@@ -229,7 +229,7 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
229229
mapvalues = (f, dict) -> Dict(k => f(v) for (k, v) in dict)
230230
f_inner = v -> Pkg.Types.VersionRange.(v)
231231
f_outer = dict -> mapvalues(f_inner, dict)
232-
Test.@test mapvalues(f_outer, compressed) == mapvalues(f_outer, compat)
232+
Test.@test _spacify_hyphens(mapvalues(f_outer, compressed)) == _spacify_hyphens(mapvalues(f_outer, compat))
233233
else
234234
@debug "Compat.toml file does not exist" compatfile
235235
end
@@ -251,3 +251,23 @@ function test(path=pwd(); registry_deps::Vector{<:AbstractString}=String[])
251251
end
252252
return nothing
253253
end
254+
255+
# Change all occurences of "digit-digit" to "digit - digit"
256+
function _spacify_hyphens(str::AbstractString)
257+
r = r"(\d)-(\d)"
258+
s = s"\1 - \2"
259+
new_str = replace(str, r => s)
260+
end
261+
262+
# Apply `_spacify_hyphens()` recursively through a dictionary
263+
function _spacify_hyphens(dict::Dict{K, V}) where {K, V}
264+
new_dict = Dict{K, V}()
265+
for (k, v) in pairs(dict)
266+
new_k = _spacify_hyphens(k)
267+
new_v = _spacify_hyphens(v)
268+
end
269+
return new_dict
270+
end
271+
272+
_spacify_hyphens(range::Pkg.Types.VersionRange) = range
273+
_spacify_hyphens(ranges::Vector{Pkg.Types.VersionRange}) = ranges

test/runtests.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,16 @@ const AutoMerge = RegistryCI.AutoMerge
1616
# disable the Pkg server.
1717
ENV["JULIA_PKG_SERVER"] = ""
1818

19+
@static if Base.VERSION < v"1.11"
20+
# BrokenRecord fails to precompile on Julia 1.11
21+
Pkg.add(;
22+
name = "BrokenRecord",
23+
uuid = "bdd55f5b-6e67-4da1-a080-6086e55655a0",
24+
version = "0.1.3",
25+
)
26+
import BrokenRecord
27+
end
28+
1929
@testset "RegistryCI.jl" begin
2030
@testset "RegistryCI.jl unit tests" begin
2131
@info("Running the RegistryCI.jl unit tests")

0 commit comments

Comments
 (0)