Skip to content

Commit

Permalink
test fixes, news
Browse files Browse the repository at this point in the history
  • Loading branch information
stevengj committed Feb 16, 2018
1 parent 05a1415 commit 5467e0e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,8 +180,8 @@ Language changes
backslashes and the end of the literal while 2n+1 backslashes followed by a quote encodes n
backslashes followed by a quote character ([#22926]).

* `reprmime(mime, x)` has been renamed to `repr(mime, x)`, and along with `repr(x)` it
now also accepts zero or more `:symbol=>value` pairs specifying `IOContext` attributes.
* `reprmime(mime, x)` has been renamed to `repr(mime, x)`, and along with `repr(x)`
and `sprint` it now accepts an optional `context` keyword for `IOContext` attributes.
`stringmime` has been moved to the Base64 stdlib package ([#25990]).

* The syntax `(x...)` for constructing a tuple is deprecated; use `(x...,)` instead ([#24452]).
Expand Down
14 changes: 7 additions & 7 deletions base/multimedia.jl
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ _textrepr(m::MIME, x, context) = String(__binrepr(m, x, context))
_textrepr(::MIME, x::AbstractString, context) = x
_textrepr(m::MIME"text/plain", x::AbstractString, context) = String(__binrepr(m, x, context))

function __binrepr(m::MIME, x, ::Nothing)
s = IOBuffer()
show(s, m, x)
take!(s)
end

function __binrepr(m::MIME, x, context)
s = IOBuffer(sizehint=sizehint)
show(IOContext(s, context), m, x)
s = IOBuffer()
if context === nothing
show(s, m, x)
else
show(IOContext(s, context), m, x)
end
take!(s)
end
_binrepr(m::MIME, x, context) = __binrepr(m, x, context)
Expand Down
2 changes: 1 addition & 1 deletion test/show.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ end
@test repr("text/plain", "string") == "\"string\""
@test repr("image/png", UInt8[2,3,4,7]) == UInt8[2,3,4,7]
@test repr("text/plain", 3.141592653589793) == "3.141592653589793"
@test repr("text/plain", 3.141592653589793, :compact=>true) == "3.14159"
@test repr("text/plain", 3.141592653589793, context=:compact=>true) == "3.14159"
@test repr("text/plain", context=:compact=>true) == "\"text/plain\""
@test repr(MIME("text/plain"), context=:compact=>true) == "MIME type text/plain"
end

0 comments on commit 5467e0e

Please sign in to comment.