Skip to content

Commit

Permalink
Drop compat code for array-like access to Cmd from #379
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholters committed Sep 30, 2019
1 parent f9257b4 commit f9ff3b6
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 24 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* `isnothing` for testing if a variable is equal to `nothing` ([#29674]).

* `Cmd` elements can be accessed as if the `Cmd` were an array of strings for 0.6 and below ([#21197]).

* `Val(x)` constructs `Val{x}()`. ([#22475])

* The `reshape` and `ntuple` APIs are extended to support `Val{x}()` arguments on 0.6 and below.
Expand Down
11 changes: 0 additions & 11 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,17 +14,6 @@ import Base.invokelatest

include("compatmacro.jl")

# https://github.com/JuliaLang/julia/pull/21197
if VERSION < v"0.7.0-DEV.257"
# allow the elements of the Cmd to be accessed as an array or iterator
for f in (:length, :endof, :start, :eachindex, :eltype, :first, :last)
@eval Base.$f(cmd::Cmd) = $f(cmd.exec)
end
for f in (:next, :done, :getindex)
@eval Base.$f(cmd::Cmd, i) = $f(cmd.exec, i)
end
end

# https://github.com/JuliaLang/julia/pull/22475
@static if VERSION < v"0.7.0-DEV.843"
import Base: Val
Expand Down
11 changes: 11 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -119,3 +119,14 @@ for (t, s, m, kept) in [
@test Compat.readuntil(IOBuffer(t), collect(s)::Vector{Char}) == Vector{Char}(m)
@test Compat.readuntil(IOBuffer(t), collect(s)::Vector{Char}, keep=true) == Vector{Char}(kept)
end

# PR #21197
let c = `ls -l "foo bar"`
@test collect(c) == ["ls", "-l", "foo bar"]
@test first(c) == "ls" == c[1]
@test last(c) == "foo bar" == c[3] == c[end]
@test c[1:2] == ["ls", "-l"]
@test eltype(c) == String
@test length(c) == 3
@test eachindex(c) == 1:3
end
11 changes: 0 additions & 11 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,6 @@ for x in (3.1, -17, 3//4, big(111.1), Inf)
@test minmax(x) == (x, x)
end

# PR #21197
let c = `ls -l "foo bar"`
@test collect(c) == ["ls", "-l", "foo bar"]
@test first(c) == "ls" == c[1]
@test last(c) == "foo bar" == c[3] == c[end]
@test c[1:2] == ["ls", "-l"]
@test eltype(c) == String
@test length(c) == 3
@test eachindex(c) == 1:3
end

# PR 22629
@test logdet(0.5) == log(det(0.5))

Expand Down

0 comments on commit f9ff3b6

Please sign in to comment.