Skip to content

Commit

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

* Three-argument methods `prevind(s,i,n)`, `nextind(s,i,n)` ([#23805]), and `length(s,i,j)` ([#24999]); the latter two replace `chr2ind` and `ind2chr` in Julia 0.7, respectively.

* `printstyled` prints to a given stream optionally in color and/or bolded ([#25522]).

* `Compat.names` supporting keyword arguments for `all` and `imported` ([#25647]).

* `Compat.IOBuffer` supporting keyword arguments ([#25873]).
Expand Down
9 changes: 0 additions & 9 deletions src/Compat.jl
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,6 @@ end
end
end

# 0.7.0-DEV.3585
@static if !isdefined(Base, :printstyled)
printstyled(io::IO, msg...; bold=false, color=:normal) =
Base.print_with_color(color, io, msg...; bold=bold)
printstyled(msg...; bold=false, color=:normal) =
Base.print_with_color(color, STDOUT, msg...; bold=bold)
export printstyled
end

# 0.7.0-DEV.3455
@static if !isdefined(Base, :hasmethod)
const hasmethod = method_exists
Expand Down
13 changes: 13 additions & 0 deletions test/old.jl
Original file line number Diff line number Diff line change
Expand Up @@ -714,3 +714,16 @@ end
@test lastindex(zeros(4)) == 4
@test lastindex(zeros(4,4)) == 16
@test all(x -> firstindex(x) == 1, ([1, 2], [1 2; 3 4], 'a', 1, 1=>2, `foo`, "foo", (1, 2)))

# 0.7.0-DEV.3585
let buf = IOBuffer()
if VERSION < v"0.7.0-DEV.3077"
col = Base.have_color
eval(Base, :(have_color = true))
printstyled(buf, "foo", color=:red)
eval(Base, :(have_color = $col))
else
printstyled(IOContext(buf, :color=>true), "foo", color=:red)
end
@test startswith(String(take!(buf)), Base.text_colors[:red])
end
13 changes: 0 additions & 13 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -82,19 +82,6 @@ end

@test codeunit("foo") == codeunit(SubString("fooαβγ",1,3)) == UInt8

# 0.7.0-DEV.3585
let buf = IOBuffer()
if VERSION < v"0.7.0-DEV.3077"
col = Base.have_color
eval(Base, :(have_color = true))
printstyled(buf, "foo", color=:red)
eval(Base, :(have_color = $col))
else
printstyled(IOContext(buf, :color=>true), "foo", color=:red)
end
@test startswith(String(take!(buf)), Base.text_colors[:red])
end

# 0.7.0-DEV.3455
@test hasmethod(sin, Tuple{Float64})
let x = y = 1
Expand Down

0 comments on commit 490a6bc

Please sign in to comment.