Skip to content

Commit

Permalink
Add an isless method for Base.UUID (JuliaLang#30947)
Browse files Browse the repository at this point in the history
This permits the removal of a pirated method in Pkg.
  • Loading branch information
ararslan authored and StefanKarpinski committed Feb 4, 2019
1 parent d4018df commit 5695f83
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions base/uuid.jl
Original file line number Diff line number Diff line change
Expand Up @@ -65,3 +65,5 @@ end

print(io::IO, u::UUID) = print(io, string(u))
show(io::IO, u::UUID) = print(io, "UUID(\"", u, "\")")

isless(a::UUID, b::UUID) = isless(a.value, b.value)
7 changes: 7 additions & 0 deletions test/misc.jl
Original file line number Diff line number Diff line change
Expand Up @@ -723,3 +723,10 @@ end
end
end
end

@testset "ordering UUIDs" begin
a = Base.UUID("dbd321ed-e87e-4f33-9511-65b7d01cdd55")
b = Base.UUID("2832b20a-2ad5-46e9-abb1-2d20c8c31dd3")
@test isless(b, a)
@test sort([a, b]) == [b, a]
end

0 comments on commit 5695f83

Please sign in to comment.