Skip to content

Commit 861063c

Browse files
committed
Add test for invalid input which passes on all platforms
Contrary to the ASCII test above, this one also fails on Windows already, and can help tracking regressions.
1 parent 368b340 commit 861063c

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

test/runtests.jl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,18 @@ if OS_NAME != :Windows
6969
end
7070
end
7171

72+
let x = encode("ÄÆä", "ISO-8859-1")
73+
@test_throws ErrorException decode(x, "UTF-8")
74+
try
75+
decode(x, "UTF-8")
76+
catch err
77+
io = IOBuffer()
78+
showerror(io, err)
79+
@test takebuf_string(io) ==
80+
"iconv error: byte sequence 0xc4c6e4 is invalid in source encoding or cannot be represented in target encoding"
81+
end
82+
end
83+
7284
mktemp() do p, io
7385
s = "café crème"
7486
write(io, encode(s, "CP1252"))

0 commit comments

Comments
 (0)