Skip to content

Commit

Permalink
Remove redirect_std*(f, stream) definitions for Julia prior to v0.6
Browse files Browse the repository at this point in the history
Were added in #275.
  • Loading branch information
martinholters committed Aug 31, 2018
1 parent 7de9ea2 commit b9289ba
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 41 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,8 +122,6 @@ Currently, the `@compat` macro supports the following syntaxes:

* [`normalize`](http://docs.julialang.org/en/latest/stdlib/linalg/?highlight=normalize#Base.normalize) and [`normalize!`](http://docs.julialang.org/en/latest/stdlib/linalg/?highlight=normalize#Base.normalize!), normalizes a vector with respect to the p-norm ([#13681])

* `redirect_stdout`, `redirect_stderr`, and `redirect_stdin` take an optional function as a first argument, `redirect_std*(f, stream)`, so that one may use `do` block syntax (as first available for Julia 0.6)

* `unsafe_get` returns the `:value` field of a `Nullable` object without any null-check and has a generic fallback for non-`Nullable` argument ([#18484])

* `isnull` has a generic fallback for non-`Nullable` argument
Expand Down
11 changes: 0 additions & 11 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -87,17 +87,6 @@ end
eval(mod, :(include_string($code, $fname)))
end

import Base: redirect_stdin, redirect_stdout, redirect_stderr
if VERSION < v"0.6.0-dev.374"
for (F,S) in ((:redirect_stdin, :STDIN), (:redirect_stdout, :STDOUT), (:redirect_stderr, :STDERR))
@eval function $F(f::Function, stream)
STDOLD = $S
$F(stream)
try f() finally $F(STDOLD) end
end
end
end

@static if VERSION < v"0.6.0-dev.528"
macro __DIR__()
Base.source_dir()
Expand Down
28 changes: 0 additions & 28 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -21,34 +21,6 @@ for os in [:apple, :bsd, :linux, :unix, :windows]
@eval @test Compat.Sys.$(Symbol("is", os))() == $from_base()
end

# do-block redirect_std*
# 0.6
let filename = tempname()
ret = open(filename, "w") do f
redirect_stdout(f) do
println("hello")
[1,3]
end
end
@test ret == [1,3]
@test chomp(read(filename, String)) == "hello"
ret = open(filename, "w") do f
redirect_stderr(f) do
println(stderr, "WARNING: hello")
[2]
end
end
@test ret == [2]
@test occursin("WARNING: hello", read(filename, String))
ret = open(filename) do f
redirect_stdin(f) do
readline()
end
end
@test occursin("WARNING: hello", ret)
rm(filename)
end

# 0.6
@test @__DIR__() == dirname(@__FILE__)

Expand Down

0 comments on commit b9289ba

Please sign in to comment.