@@ -32,6 +32,16 @@ void testDecodeSlice() {
32
32
Expect .equals ("BCD" , decoder.convert (ascii, 1 , 4 ));
33
33
Expect .equals ("ABCD" , decoder.convert (ascii, 0 , 4 ));
34
34
35
+ if (ascii is Uint8List ) {
36
+ Expect .equals ("ABCDE" , decoder.convert (Uint8List .sublistView (ascii, 0 )));
37
+ Expect .equals ("ABCDE" ,
38
+ decoder.convert (Uint8List .sublistView (ascii, 0 , ascii.length)));
39
+ Expect .equals ("CDE" , decoder.convert (Uint8List .sublistView (ascii, 2 )));
40
+ Expect .equals ("BCD" , decoder.convert (Uint8List .sublistView (ascii, 1 , 4 )));
41
+ Expect .equals (
42
+ "ABCD" , decoder.convert (Uint8List .sublistView (ascii, 0 , 4 )));
43
+ }
44
+
35
45
Expect .throws (() => decoder.convert (ascii, - 1 )); // start < 0.
36
46
Expect .throws (() => decoder.convert (ascii, 6 )); // start > length
37
47
Expect .throws (() => decoder.convert (ascii, 0 , - 1 )); // end < 0
@@ -48,6 +58,18 @@ void testDecodeSlice() {
48
58
Expect .equals ("\u 0082\u 1041" , decoder.convert (utf8, 2 ));
49
59
Expect .equals ("\u 0081\u 0082" , decoder.convert (utf8, 0 , 4 ));
50
60
Expect .equals ("\u 0082" , decoder.convert (utf8, 2 , 4 ));
61
+
62
+ if (utf8 is Uint8List ) {
63
+ Expect .equals ("\u 0081\u 0082\u 1041" ,
64
+ decoder.convert (Uint8List .sublistView (utf8, 0 )));
65
+ Expect .equals (
66
+ "\u 0082\u 1041" , decoder.convert (Uint8List .sublistView (utf8, 2 )));
67
+ Expect .equals (
68
+ "\u 0081\u 0082" , decoder.convert (Uint8List .sublistView (utf8, 0 , 4 )));
69
+ Expect .equals (
70
+ "\u 0082" , decoder.convert (Uint8List .sublistView (utf8, 2 , 4 )));
71
+ }
72
+
51
73
Expect .throws (() => decoder.convert (utf8, 1 ));
52
74
Expect .throws (() => decoder.convert (utf8, 0 , 1 ));
53
75
Expect .throws (() => decoder.convert (utf8, 2 , 5 ));
0 commit comments