vtjnash / Glob.jl

Posix-compliant file name pattern matching
Other
126 stars 18 forks source link

Rename ismatch to occursin; fix 0.7 depwarns #15

Closed jmkuhn closed 6 years ago

jmkuhn commented 6 years ago

ismatch has been renamed to occursin in Julia Base. https://github.com/JuliaLang/julia/pull/24673 https://github.com/JuliaLang/julia/pull/26283

To accommodate this in Glob, for Julia 0.6 allow either ismatch or occursin to be used.

julia> using Glob

julia> using Compat

julia> ismatch(fn"AB*AB*AB", "ABXABXAB")
true

julia> occursin(fn"AB*AB*AB", "ABXABXAB")
true

With the current 0.7 nightly, ismatch produces a deprecation warning.

julia> using Glob

julia> ismatch(fn"AB*AB*AB", "ABXABXAB")
┌ Warning: `ismatch(fn::FilenameMatch, s::AbstractString)` is deprecated, use `occursin(fn, s)` instead.
│   caller = top-level scope
└ @ Core :0
true

julia> occursin(fn"AB*AB*AB", "ABXABXAB")
true

I'm not sure my updates to the iterator are the best way to do this. If you have any suggestions, let me know.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+1.1%) to 91.866% when pulling d1a4a75d511586420a42c2609721c7683ef2c2b0 on jmkuhn:0.7 into 8ca3670f1edf579db487c3cd058d5606ee94ff6f on vtjnash:master.

coveralls commented 6 years ago

Coverage Status

Coverage increased (+2.3%) to 93.056% when pulling 442c15efdec1ce5559acda08eaa44659132246d2 on jmkuhn:0.7 into 8ca3670f1edf579db487c3cd058d5606ee94ff6f on vtjnash:master.

jmkuhn commented 6 years ago

Thanks for the thorough review. The iterator code looks much better now.