Skip to content

Commit 0b31cf1

Browse files
committed
Test show(::Encoding) and print(::Encoding), improve message
This is an instance, not a type.
1 parent 08f5659 commit 0b31cf1

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/encodings.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ end
1414

1515
convert{T<:AbstractString, enc}(::Type{T}, ::Encoding{enc}) = string(enc)
1616

17-
show{enc}(io::IO, ::Encoding{enc}) = print(io, string(enc), " string encoding type")
17+
show{enc}(io::IO, ::Encoding{enc}) = print(io, string(enc), " string encoding")
1818
print{enc}(io::IO, ::Encoding{enc}) = print(io, enc)
1919

2020

test/runtests.jl

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,10 @@ end
170170

171171

172172
## Test encodings support
173+
b = IOBuffer()
174+
show(b, enc"UTF-8")
175+
@test takebuf_string(b) == "UTF-8 string encoding"
176+
@test string(enc"UTF-8") == "UTF-8"
173177

174178
encodings_list = encodings()
175179
@test "ASCII" in encodings_list

0 commit comments

Comments
 (0)