Skip to content

Commit

Permalink
Char compact 3-arg show (#34730)
Browse files Browse the repository at this point in the history
  • Loading branch information
omus authored Feb 12, 2020
1 parent a211abc commit 477d031
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions base/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ end

function show(io::IO, ::MIME"text/plain", c::T) where {T<:AbstractChar}
show(io, c)
get(io, :compact, false) && return
if !ismalformed(c)
print(io, ": ")
if isoverlong(c)
Expand Down
1 change: 1 addition & 0 deletions test/char.jl
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ end

@testset "sprint, repr" begin
@test sprint(show, "text/plain", '$') == "'\$': ASCII/Unicode U+0024 (category Sc: Symbol, currency)"
@test sprint(show, "text/plain", '$', context=:compact => true) == "'\$'"
@test repr('$') == "'\$'"
end

Expand Down

0 comments on commit 477d031

Please sign in to comment.