Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(414)

Side by Side Diff: tests/corelib/iterable_take_test.dart

Issue 12295009: Recommit changing List.skip/take/revert returns Iterable and remove mappedBy. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Make Future.wait simpler. Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 main() { 5 main() {
6 List<int> list1 = <int>[1, 2, 3]; 6 List<int> list1 = <int>[1, 2, 3];
7 List<int> list2 = const <int>[4, 5]; 7 List<int> list2 = const <int>[4, 5];
8 List<String> list3 = <String>[]; 8 List<String> list3 = <String>[];
9 Set<int> set1 = new Set<int>(); 9 Set<int> set1 = new Set<int>();
10 set1..add(11) 10 set1..add(11)
11 ..add(12) 11 ..add(12)
12 ..add(13); 12 ..add(13);
13 Set set2 = new Set(); 13 Set set2 = new Set();
14 14
15 Iterable<int> take0 = list1.take(0); 15 Iterable<int> take0 = list1.take(0);
16 Expect.isTrue(take0 is List);
17 Expect.isTrue(take0.take(2).take(1) is List);
18 Iterator<int> it = take0.iterator; 16 Iterator<int> it = take0.iterator;
19 Expect.isNull(it.current); 17 Expect.isNull(it.current);
20 Expect.isFalse(it.moveNext()); 18 Expect.isFalse(it.moveNext());
21 Expect.isNull(it.current); 19 Expect.isNull(it.current);
22 20
23 Iterable<int> take1 = list1.take(1); 21 Iterable<int> take1 = list1.take(1);
24 Expect.isTrue(take1 is List);
25 Expect.isTrue(take1.take(2).take(1) is List);
26 it = take1.iterator; 22 it = take1.iterator;
27 Expect.isNull(it.current); 23 Expect.isNull(it.current);
28 Expect.isTrue(it.moveNext()); 24 Expect.isTrue(it.moveNext());
29 Expect.equals(1, it.current); 25 Expect.equals(1, it.current);
30 Expect.isFalse(it.moveNext()); 26 Expect.isFalse(it.moveNext());
31 Expect.isNull(it.current); 27 Expect.isNull(it.current);
32 28
33 Iterable<int> take2 = list1.take(2); 29 Iterable<int> take2 = list1.take(2);
34 it = take2.iterator; 30 it = take2.iterator;
35 Expect.isTrue(take2 is List);
36 Expect.isTrue(take2.take(2).take(1) is List);
37 Expect.isNull(it.current); 31 Expect.isNull(it.current);
38 Expect.isTrue(it.moveNext()); 32 Expect.isTrue(it.moveNext());
39 Expect.equals(1, it.current); 33 Expect.equals(1, it.current);
40 Expect.isTrue(it.moveNext()); 34 Expect.isTrue(it.moveNext());
41 Expect.equals(2, it.current); 35 Expect.equals(2, it.current);
42 Expect.isFalse(it.moveNext()); 36 Expect.isFalse(it.moveNext());
43 Expect.isNull(it.current); 37 Expect.isNull(it.current);
44 38
45 Iterable<int> take3 = list1.take(3); 39 Iterable<int> take3 = list1.take(3);
46 Expect.isTrue(take3 is List);
47 Expect.isTrue(take3.take(2).take(1) is List);
48 it = take3.iterator; 40 it = take3.iterator;
49 Expect.isNull(it.current); 41 Expect.isNull(it.current);
50 Expect.isTrue(it.moveNext()); 42 Expect.isTrue(it.moveNext());
51 Expect.equals(1, it.current); 43 Expect.equals(1, it.current);
52 Expect.isTrue(it.moveNext()); 44 Expect.isTrue(it.moveNext());
53 Expect.equals(2, it.current); 45 Expect.equals(2, it.current);
54 Expect.isTrue(it.moveNext()); 46 Expect.isTrue(it.moveNext());
55 Expect.equals(3, it.current); 47 Expect.equals(3, it.current);
56 Expect.isFalse(it.moveNext()); 48 Expect.isFalse(it.moveNext());
57 Expect.isNull(it.current); 49 Expect.isNull(it.current);
58 50
59 Iterable<int> take4 = list1.take(4); 51 Iterable<int> take4 = list1.take(4);
60 Expect.isTrue(take4 is List);
61 Expect.isTrue(take4.take(2).take(1) is List);
62 it = take4.iterator; 52 it = take4.iterator;
63 Expect.isNull(it.current); 53 Expect.isNull(it.current);
64 Expect.isTrue(it.moveNext()); 54 Expect.isTrue(it.moveNext());
65 Expect.equals(1, it.current); 55 Expect.equals(1, it.current);
66 Expect.isTrue(it.moveNext()); 56 Expect.isTrue(it.moveNext());
67 Expect.equals(2, it.current); 57 Expect.equals(2, it.current);
68 Expect.isTrue(it.moveNext()); 58 Expect.isTrue(it.moveNext());
69 Expect.equals(3, it.current); 59 Expect.equals(3, it.current);
70 Expect.isFalse(it.moveNext()); 60 Expect.isFalse(it.moveNext());
71 Expect.isNull(it.current); 61 Expect.isNull(it.current);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 Expect.isTrue(it.moveNext()); 98 Expect.isTrue(it.moveNext());
109 Expect.equals(1, it.current); 99 Expect.equals(1, it.current);
110 Expect.isTrue(it.moveNext()); 100 Expect.isTrue(it.moveNext());
111 Expect.equals(2, it.current); 101 Expect.equals(2, it.current);
112 Expect.isTrue(it.moveNext()); 102 Expect.isTrue(it.moveNext());
113 Expect.equals(3, it.current); 103 Expect.equals(3, it.current);
114 Expect.isFalse(it.moveNext()); 104 Expect.isFalse(it.moveNext());
115 Expect.isNull(it.current); 105 Expect.isNull(it.current);
116 106
117 take0 = list2.take(0); 107 take0 = list2.take(0);
118 Expect.isTrue(take0 is List);
119 Expect.isTrue(take0.take(2).take(1) is List);
120 it = take0.iterator; 108 it = take0.iterator;
121 Expect.isNull(it.current); 109 Expect.isNull(it.current);
122 Expect.isFalse(it.moveNext()); 110 Expect.isFalse(it.moveNext());
123 Expect.isNull(it.current); 111 Expect.isNull(it.current);
124 112
125 take1 = list2.take(1); 113 take1 = list2.take(1);
126 Expect.isTrue(take1 is List);
127 Expect.isTrue(take1.take(2).take(1) is List);
128 it = take1.iterator; 114 it = take1.iterator;
129 Expect.isNull(it.current); 115 Expect.isNull(it.current);
130 Expect.isTrue(it.moveNext()); 116 Expect.isTrue(it.moveNext());
131 Expect.equals(4, it.current); 117 Expect.equals(4, it.current);
132 Expect.isFalse(it.moveNext()); 118 Expect.isFalse(it.moveNext());
133 Expect.isNull(it.current); 119 Expect.isNull(it.current);
134 120
135 take2 = list2.take(2); 121 take2 = list2.take(2);
136 Expect.isTrue(take2 is List);
137 Expect.isTrue(take2.take(2).take(1) is List);
138 it = take2.iterator; 122 it = take2.iterator;
139 Expect.isNull(it.current); 123 Expect.isNull(it.current);
140 Expect.isTrue(it.moveNext()); 124 Expect.isTrue(it.moveNext());
141 Expect.equals(4, it.current); 125 Expect.equals(4, it.current);
142 Expect.isTrue(it.moveNext()); 126 Expect.isTrue(it.moveNext());
143 Expect.equals(5, it.current); 127 Expect.equals(5, it.current);
144 Expect.isFalse(it.moveNext()); 128 Expect.isFalse(it.moveNext());
145 Expect.isNull(it.current); 129 Expect.isNull(it.current);
146 130
147 take3 = list2.take(3); 131 take3 = list2.take(3);
148 Expect.isTrue(take3 is List);
149 Expect.isTrue(take3.take(2).take(1) is List);
150 it = take3.iterator; 132 it = take3.iterator;
151 Expect.isNull(it.current); 133 Expect.isNull(it.current);
152 Expect.isTrue(it.moveNext()); 134 Expect.isTrue(it.moveNext());
153 Expect.equals(4, it.current); 135 Expect.equals(4, it.current);
154 Expect.isTrue(it.moveNext()); 136 Expect.isTrue(it.moveNext());
155 Expect.equals(5, it.current); 137 Expect.equals(5, it.current);
156 Expect.isFalse(it.moveNext()); 138 Expect.isFalse(it.moveNext());
157 Expect.isNull(it.current); 139 Expect.isNull(it.current);
158 140
159 Iterable<String> take02 = list3.take(0); 141 Iterable<String> take02 = list3.take(0);
160 Expect.isTrue(take02 is List);
161 Expect.isTrue(take02.take(2).take(1) is List);
162 Iterator<String> it2 = take02.iterator; 142 Iterator<String> it2 = take02.iterator;
163 Expect.isNull(it2.current); 143 Expect.isNull(it2.current);
164 Expect.isFalse(it2.moveNext()); 144 Expect.isFalse(it2.moveNext());
165 Expect.isNull(it2.current); 145 Expect.isNull(it2.current);
166 146
167 Iterable<String> take12 = list3.take(1); 147 Iterable<String> take12 = list3.take(1);
168 Expect.isTrue(take12 is List);
169 Expect.isTrue(take12.take(2).take(1) is List);
170 it2 = take12.iterator; 148 it2 = take12.iterator;
171 Expect.isNull(it2.current); 149 Expect.isNull(it2.current);
172 Expect.isFalse(it2.moveNext()); 150 Expect.isFalse(it2.moveNext());
173 Expect.isNull(it2.current); 151 Expect.isNull(it2.current);
174 152
175 take0 = set1.take(0); 153 take0 = set1.take(0);
176 it = take0.iterator; 154 it = take0.iterator;
177 Expect.isNull(it.current); 155 Expect.isNull(it.current);
178 Expect.isFalse(it.moveNext()); 156 Expect.isFalse(it.moveNext());
179 Expect.isNull(it.current); 157 Expect.isNull(it.current);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 Expect.isNull(it.current); 207 Expect.isNull(it.current);
230 Expect.isFalse(it.moveNext()); 208 Expect.isFalse(it.moveNext());
231 Expect.isNull(it.current); 209 Expect.isNull(it.current);
232 210
233 take1 = set2.take(1); 211 take1 = set2.take(1);
234 it = take1.iterator; 212 it = take1.iterator;
235 Expect.isNull(it.current); 213 Expect.isNull(it.current);
236 Expect.isFalse(it.moveNext()); 214 Expect.isFalse(it.moveNext());
237 Expect.isNull(it.current); 215 Expect.isNull(it.current);
238 } 216 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698