From f9ff3b6178bed92f4154ea57dc7f9bf2f1c158f5 Mon Sep 17 00:00:00 2001 From: Martin Holters Date: Mon, 30 Sep 2019 17:07:59 +0200 Subject: [PATCH] Drop compat code for array-like access to `Cmd` from #379 --- README.md | 2 -- src/Compat.jl | 11 ----------- test/old.jl | 11 +++++++++++ test/runtests.jl | 11 ----------- 4 files changed, 11 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index d44570bd3..8a6118076 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/src/Compat.jl b/src/Compat.jl index 67b8a7df8..36bd221c7 100644 --- a/src/Compat.jl +++ b/src/Compat.jl @@ -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 diff --git a/test/old.jl b/test/old.jl index a243f9039..b5c8e8d4a 100644 --- a/test/old.jl +++ b/test/old.jl @@ -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 diff --git a/test/runtests.jl b/test/runtests.jl index decc88e4e..cc01c48d6 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -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))