@@ -52,12 +52,17 @@ test_to_list_latin1() ->
52
52
test_to_list_utf8 () ->
53
53
" hello" = unicode :characters_to_list (<<" hello" >>),
54
54
" hello" = unicode :characters_to_list (" hello" , utf8 ),
55
+ " hello" = unicode :characters_to_list (" hello" , unicode ),
55
56
" hé" = unicode :characters_to_list (<<" hé" /utf8 >>),
56
57
" hé" = unicode :characters_to_list (" hé" ),
57
58
" hé" = unicode :characters_to_list (<<" hé" /utf8 >>, utf8 ),
59
+ " hé" = unicode :characters_to_list (<<" hé" /utf8 >>, unicode ),
58
60
{error , " h" , [- 1 ]} = unicode :characters_to_list ([$h , - 1 ], utf8 ),
61
+ {error , " h" , [- 1 ]} = unicode :characters_to_list ([$h , - 1 ], unicode ),
59
62
[$h , 16#10ffff ] = unicode :characters_to_list ([$h , 16#10ffff ], utf8 ),
63
+ [$h , 16#10ffff ] = unicode :characters_to_list ([$h , 16#10ffff ], unicode ),
60
64
{error , " h" , [16#110000 ]} = unicode :characters_to_list ([$h , 16#110000 ], utf8 ),
65
+ {error , " h" , [16#110000 ]} = unicode :characters_to_list ([$h , 16#110000 ], unicode ),
61
66
{incomplete , " h" , <<" é" >>} = unicode :characters_to_list (<<" hé" >>),
62
67
{error , [], <<16#A0 , 16#A1 >>} = unicode :characters_to_list (<<16#A0 , 16#A1 >>),
63
68
% Erlang/OTP documentation writes: "The last part is mostly for debugging"
@@ -131,10 +136,21 @@ test_to_binary_latin1() ->
131
136
132
137
test_to_binary_utf8 () ->
133
138
<<" hello" >> = unicode :characters_to_binary (" hello" , utf8 , utf8 ),
139
+ <<" hello" >> = unicode :characters_to_binary (" hello" , unicode , unicode ),
140
+ <<" hello" >> = unicode :characters_to_binary (" hello" , utf8 , unicode ),
141
+ <<" hello" >> = unicode :characters_to_binary (" hello" , unicode , utf8 ),
134
142
<<" hello" >> = unicode :characters_to_binary (<<" hello" >>, utf8 , utf8 ),
143
+ <<" hello" >> = unicode :characters_to_binary (<<" hello" >>, unicode , unicode ),
144
+ <<" hello" >> = unicode :characters_to_binary (<<" hello" >>, utf8 , unicode ),
145
+ <<" hello" >> = unicode :characters_to_binary (<<" hello" >>, unicode , utf8 ),
135
146
<<" hé" /utf8 >> = unicode :characters_to_binary (" hé" , latin1 , utf8 ),
147
+ <<" hé" /utf8 >> = unicode :characters_to_binary (" hé" , latin1 , unicode ),
136
148
<<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>, utf8 , utf8 ),
149
+ <<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>, unicode , unicode ),
150
+ <<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>, utf8 , unicode ),
151
+ <<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>, unicode , utf8 ),
137
152
<<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>, utf8 ),
153
+ <<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>, unicode ),
138
154
<<" hé" /utf8 >> = unicode :characters_to_binary (<<" hé" /utf8 >>),
139
155
{error , <<" h" >>, [- 1 ]} = unicode :characters_to_binary ([$h , - 1 ]),
140
156
<<" h" , 244 , 143 , 191 , 191 >> = unicode :characters_to_binary ([$h , 16#10FFFF ]),
0 commit comments