@@ -59,7 +59,7 @@ void main() {
59
59
'starts from the final element if start is greater than the length '
60
60
'of the list' , () {
61
61
final list = [1 , 2 , 3 , 4 ];
62
- expect (list.slice (start: 100 , end: 1 ), []);
62
+ expect (list.slice (start: 100 , end: 1 ), < int > []);
63
63
expect (list.slice (start: 100 , end: 1 , step: - 1 ), [4 , 3 ]);
64
64
});
65
65
@@ -81,65 +81,65 @@ void main() {
81
81
'ends with the first element if end is less than the negative length '
82
82
'of the list' , () {
83
83
final list = [1 , 2 , 3 , 4 ];
84
- expect (list.slice (start: 2 , end: - 100 ), []);
84
+ expect (list.slice (start: 2 , end: - 100 ), < int > []);
85
85
expect (list.slice (start: 2 , end: - 100 , step: - 1 ), [3 , 2 , 1 ]);
86
86
});
87
87
88
88
test ('returns an empty list if start and end are equal' , () {
89
89
final list = [1 , 2 , 3 , 4 , 5 ];
90
- expect (list.slice (start: 2 , end: 2 ), []);
91
- expect (list.slice (start: - 2 , end: - 2 ), []);
90
+ expect (list.slice (start: 2 , end: 2 ), < int > []);
91
+ expect (list.slice (start: - 2 , end: - 2 ), < int > []);
92
92
});
93
93
94
94
test (
95
95
'returns an empty list if start and end are not equal but correspond '
96
96
'to the same element' , () {
97
97
final list = [1 , 2 , 3 , 4 ];
98
- expect (list.slice (start: 1 , end: - 3 ), []);
99
- expect (list.slice (start: 2 , end: - 2 ), []);
98
+ expect (list.slice (start: 1 , end: - 3 ), < int > []);
99
+ expect (list.slice (start: 2 , end: - 2 ), < int > []);
100
100
});
101
101
102
102
test (
103
103
'returns an empty list if start (or its equivalent index) is greater '
104
104
'than end (or its equivalent index) and step is positive' , () {
105
105
final list = [1 , 2 , 3 , 4 ];
106
- expect (list.slice (start: 3 , end: 1 ), []);
107
- expect (list.slice (start: - 1 , end: 1 ), []);
108
- expect (list.slice (start: 3 , end: - 3 ), []);
109
- expect (list.slice (start: - 1 , end: - 3 ), []);
110
- expect (list.slice (start: 3 , end: - 100 ), []);
106
+ expect (list.slice (start: 3 , end: 1 ), < int > []);
107
+ expect (list.slice (start: - 1 , end: 1 ), < int > []);
108
+ expect (list.slice (start: 3 , end: - 3 ), < int > []);
109
+ expect (list.slice (start: - 1 , end: - 3 ), < int > []);
110
+ expect (list.slice (start: 3 , end: - 100 ), < int > []);
111
111
});
112
112
113
113
test (
114
114
'returns an empty list if start (or its equivalent index) is less than '
115
115
'end (or its equivalent index) and step is negative' , () {
116
116
final list = [1 , 2 , 3 , 4 ];
117
- expect (list.slice (start: 1 , end: 3 , step: - 1 ), []);
118
- expect (list.slice (start: - 3 , end: 3 , step: - 1 ), []);
119
- expect (list.slice (start: 1 , end: - 1 , step: - 1 ), []);
120
- expect (list.slice (start: - 3 , end: - 1 , step: - 1 ), []);
121
- expect (list.slice (start: 1 , end: 100 , step: - 1 ), []);
117
+ expect (list.slice (start: 1 , end: 3 , step: - 1 ), < int > []);
118
+ expect (list.slice (start: - 3 , end: 3 , step: - 1 ), < int > []);
119
+ expect (list.slice (start: 1 , end: - 1 , step: - 1 ), < int > []);
120
+ expect (list.slice (start: - 3 , end: - 1 , step: - 1 ), < int > []);
121
+ expect (list.slice (start: 1 , end: 100 , step: - 1 ), < int > []);
122
122
});
123
123
124
124
test ('behaves predictably when the bounds are increased in any direction' ,
125
125
() {
126
126
final list = [1 , 2 , 3 , 4 ];
127
127
128
- expect (list.slice (start: 0 , end: 0 ), []);
128
+ expect (list.slice (start: 0 , end: 0 ), < int > []);
129
129
expect (list.slice (start: 0 , end: 1 ), [1 ]);
130
130
expect (list.slice (start: 0 , end: 2 ), [1 , 2 ]);
131
131
expect (list.slice (start: 0 , end: 3 ), [1 , 2 , 3 ]);
132
132
expect (list.slice (start: 0 , end: 4 ), [1 , 2 , 3 , 4 ]);
133
133
expect (list.slice (start: 0 , end: 5 ), [1 , 2 , 3 , 4 ]);
134
134
135
- expect (list.slice (start: 0 , end: - 5 ), []);
136
- expect (list.slice (start: 0 , end: - 4 ), []);
135
+ expect (list.slice (start: 0 , end: - 5 ), < int > []);
136
+ expect (list.slice (start: 0 , end: - 4 ), < int > []);
137
137
expect (list.slice (start: 0 , end: - 3 ), [1 ]);
138
138
expect (list.slice (start: 0 , end: - 2 ), [1 , 2 ]);
139
139
expect (list.slice (start: 0 , end: - 1 ), [1 , 2 , 3 ]);
140
140
141
- expect (list.slice (start: 5 , end: 4 ), []);
142
- expect (list.slice (start: 4 , end: 4 ), []);
141
+ expect (list.slice (start: 5 , end: 4 ), < int > []);
142
+ expect (list.slice (start: 4 , end: 4 ), < int > []);
143
143
expect (list.slice (start: 3 , end: 4 ), [4 ]);
144
144
expect (list.slice (start: 2 , end: 4 ), [3 , 4 ]);
145
145
expect (list.slice (start: 1 , end: 4 ), [2 , 3 , 4 ]);
@@ -150,18 +150,18 @@ void main() {
150
150
expect (list.slice (start: - 4 , end: 4 ), [1 , 2 , 3 , 4 ]);
151
151
expect (list.slice (start: - 5 , end: 4 ), [1 , 2 , 3 , 4 ]);
152
152
153
- expect (list.slice (start: 3 , end: 3 , step: - 1 ), []);
153
+ expect (list.slice (start: 3 , end: 3 , step: - 1 ), < int > []);
154
154
expect (list.slice (start: 3 , end: 2 , step: - 1 ), [4 ]);
155
155
expect (list.slice (start: 3 , end: 1 , step: - 1 ), [4 , 3 ]);
156
156
expect (list.slice (start: 3 , end: 0 , step: - 1 ), [4 , 3 , 2 ]);
157
157
158
- expect (list.slice (start: 3 , end: - 1 , step: - 1 ), []);
158
+ expect (list.slice (start: 3 , end: - 1 , step: - 1 ), < int > []);
159
159
expect (list.slice (start: 3 , end: - 2 , step: - 1 ), [4 ]);
160
160
expect (list.slice (start: 3 , end: - 3 , step: - 1 ), [4 , 3 ]);
161
161
expect (list.slice (start: 3 , end: - 4 , step: - 1 ), [4 , 3 , 2 ]);
162
162
expect (list.slice (start: 3 , end: - 5 , step: - 1 ), [4 , 3 , 2 , 1 ]);
163
163
164
- expect (list.slice (start: 0 , end: 0 , step: - 1 ), []);
164
+ expect (list.slice (start: 0 , end: 0 , step: - 1 ), < int > []);
165
165
expect (list.slice (start: 1 , end: 0 , step: - 1 ), [2 ]);
166
166
expect (list.slice (start: 2 , end: 0 , step: - 1 ), [3 , 2 ]);
167
167
expect (list.slice (start: 3 , end: 0 , step: - 1 ), [4 , 3 , 2 ]);
@@ -171,13 +171,13 @@ void main() {
171
171
expect (list.slice (start: - 1 , end: 0 , step: - 1 ), [4 , 3 , 2 ]);
172
172
expect (list.slice (start: - 2 , end: 0 , step: - 1 ), [3 , 2 ]);
173
173
expect (list.slice (start: - 3 , end: 0 , step: - 1 ), [2 ]);
174
- expect (list.slice (start: - 4 , end: 0 , step: - 1 ), []);
174
+ expect (list.slice (start: - 4 , end: 0 , step: - 1 ), < int > []);
175
175
176
176
expect (list.slice (start: - 1 , end: - 5 , step: - 1 ), [4 , 3 , 2 , 1 ]);
177
177
expect (list.slice (start: - 2 , end: - 5 , step: - 1 ), [3 , 2 , 1 ]);
178
178
expect (list.slice (start: - 3 , end: - 5 , step: - 1 ), [2 , 1 ]);
179
179
expect (list.slice (start: - 4 , end: - 5 , step: - 1 ), [1 ]);
180
- expect (list.slice (start: - 5 , end: - 5 , step: - 1 ), []);
180
+ expect (list.slice (start: - 5 , end: - 5 , step: - 1 ), < int > []);
181
181
});
182
182
});
183
183
@@ -248,7 +248,7 @@ void main() {
248
248
249
249
group ('takeRandom' , () {
250
250
test ('returns null for an empty list' , () {
251
- expect ([].takeRandom (), isNull);
251
+ expect (< Object > [].takeRandom (), isNull);
252
252
});
253
253
254
254
test ('removes the only element of a list of length 1' , () {
0 commit comments