Skip to content

Commit

Permalink
Add UUIDs module
Browse files Browse the repository at this point in the history
  • Loading branch information
iamed2 authored and martinholters committed Feb 13, 2018
1 parent 4ca422e commit 083c291
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
1 change: 1 addition & 0 deletions Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ SharedArrays = "1a1011a3-84de-559e-8e89-a11a2f7dc383"
SparseArrays = "2f01184e-e22b-5df5-ae63-d93ebab69eaf"
SuiteSparse = "4607b0f0-06f3-5cda-b6b1-a6196a1729e9"
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
UUIDs = "cf7118a7-6976-5b1a-9a39-7adc72f591a4"
Unicode = "4ec0a83e-493e-50e2-b9ac-8f72acf5a8f5"
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,9 @@ Currently, the `@compat` macro supports the following syntaxes:
* `using Compat.LibGit2` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25706]).

* `using Compat.UUIDs` is provided on versions older than 0.7, where this library is
not yet part of the standard library ([#25819]).

## New functions, macros, and methods

* `@views` takes an expression and converts all slices to views ([#20164]), while
Expand Down Expand Up @@ -552,4 +555,4 @@ includes this fix. Find the minimum version from there.
[#25706]: https://github.com/JuliaLang/julia/issues/25706
[#25780]: https://github.com/JuliaLang/julia/issues/25780
[#24182]: https://github.com/JuliaLang/julia/issues/24182
[#24673]: https://github.com/JuliaLang/julia/issues/24673
[#24673]: https://github.com/JuliaLang/julia/issues/24673
9 changes: 9 additions & 0 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1629,6 +1629,15 @@ else
findall(b::OccursIn, a::Number) = a in b.x ? [1] : Vector{Int}()
end

if VERSION >= v"0.7.0-DEV.3666"
import UUIDs
else
@eval module UUIDs
import ..Random: uuid1, uuid4, uuid_version, UUID
export uuid1, uuid4, uuid_version, UUID
end
end

include("deprecated.jl")

end # module Compat
15 changes: 15 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1393,4 +1393,19 @@ end
@test findall([true, false, true]) == [1, 3]
@test findall(occursin([1, 2]), [1]) == [1]

# 0.7.0-DEV.3666
module TestUUIDs
using Compat
using Compat.UUIDs
using Compat.Test
@test isdefined(@__MODULE__, :uuid1)
@test isdefined(@__MODULE__, :uuid4)
@test isdefined(@__MODULE__, :uuid_version)

@test uuid_version(uuid1()) == 1
@test uuid_version(uuid4()) == 4
@test uuid1() isa UUID
@test uuid4() isa UUID
end

nothing

0 comments on commit 083c291

Please sign in to comment.