Skip to content

Commit

Permalink
Drop compat code for occursin from #520
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Oct 8, 2019
1 parent fb3f813 commit 2bed8a5
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 38 deletions.
6 changes: 0 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -197,12 +197,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* `copy!` and `unsafe_copy!` are now `copyto!` and `unsafe_copyto!` ([#24808]).

* `contains(haystack, needle)` is now `occursin(needle, haystack)` ([#26283]).
`occursin` also has a new method for `Char` needles ([#22435]).

* `ismatch(r::Regex, str::AbstractString, offset=0)` is now `occursin(r, str)` and
`occursin(r, str, offset = offset)` respectively ([#24673],[#26283]).

* `ipermute!` is now `invpermute!` ([#25168]).

* `module_parent`, `Base.function_module`, and `Base.datatype_module` are now methods of
Expand Down
20 changes: 0 additions & 20 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -36,26 +36,6 @@ import Base: Fix2

include("compatmacro.jl")

# PR #26283
if VERSION < v"0.7.0-DEV.4639"
if isdefined(Base, :occursin)
import Base: occursin
else
export occursin
end
occursin(needle, haystack) = contains(haystack, needle)
if VERSION < v"0.7.0-DEV.3272"
occursin(r::Regex, s::AbstractString; offset::Integer = 0) = ismatch(r, s, offset)
else
occursin(r::Regex, s::AbstractString; offset::Integer = 0) = contains(s, r, offset)
end
# PR #22435
if VERSION < v"0.7.0-DEV.702"
occursin(needle::Char, haystack::AbstractString) = searchindex(haystack,needle) != 0
end
end


# 0.7.0-DEV.912
if VERSION < v"0.7.0-DEV.912"
import Base.*
Expand Down
7 changes: 7 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -475,3 +475,10 @@ let a = [0,1,2,3,0,1,2,3]
@test findprev(==(1), a, 4) == 2
@test findprev(==(1), a, 8) == 6
end

# 0.7.0-DEV.4639
@test occursin(r"World", "Hello, World!")
@test occursin(r"World", "Hello, World!", offset = 4)
@test occursin("World", "Hello, World!")
# 0.7.0-DEV.912
@test occursin('W', "Hello, World!")
12 changes: 0 additions & 12 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -208,18 +208,6 @@ let A = [0, 0, 0], B = [1, 2, 3]
@test unsafe_copyto!(A, 2, B, 1, 1) === A == [0, 1, 0]
end

# 0.7, make sure this works on 0.6
if VERSION < v"0.7.0-DEV.3272"
@test contains("Hello, World!", r"World")
end

# 0.7.0-DEV.4639
@test occursin(r"World", "Hello, World!")
@test occursin(r"World", "Hello, World!", offset = 4)
@test occursin("World", "Hello, World!")
# 0.7.0-DEV.912
@test occursin('W', "Hello, World!")

# 0.7.0-DEV.3173
@test invpermute!(permute!([1, 2], 2:-1:1), 2:-1:1) == [1, 2]

Expand Down

0 comments on commit 2bed8a5

Please sign in to comment.