@@ -5,7 +5,8 @@ for s in ("", "a", "café crème",
5
5
" a" ^ (iconv. BUFSIZE- 1 ) * " € with an incomplete codepoint between two input buffer fills" ,
6
6
" a string € チャネルパートナーの選択" )
7
7
# Test round-trip to Unicode formats, checking against pure-Julia implementation
8
- for (T, enc) in ((UTF8String, " UTF-8" ), (UTF16String, " UTF-16" ), (UTF32String, " UTF-32" ))
8
+ for T in (UTF8String, UTF16String, UTF32String)
9
+ enc = iconv. encoding_string (T)
9
10
a = reinterpret (UInt8, T (s). data)
10
11
@test decode (a, enc) == s
11
12
@test decode (encode (s, enc), enc) == s
21
22
# Test that attempt to close stream in the middle of incomplete sequence throws
22
23
# TODO : use more specific errors
23
24
let s = " a string € チャネルパートナーの選択"
24
- p = StringEncoder (IOBuffer (), " UTF-16 " )
25
+ p = StringEncoder (IOBuffer (), " UTF-16LE " )
25
26
write (p, s. data[1 : 10 ])
26
27
@test_throws ErrorException close (p)
27
28
28
- p = StringDecoder (IOBuffer (encode (s, " UTF-16 " )[1 : 21 ]), " UTF-16 " )
29
+ p = StringDecoder (IOBuffer (encode (s, " UTF-16LE " )[1 : 19 ]), " UTF-16LE " )
29
30
@test readall (p) == s[1 : 9 ]
30
31
@test_throws ErrorException close (p)
31
32
0 commit comments