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

Side by Side Diff: tests/corelib_strong/list_map_test.dart

Issue 2683893002: Make corelib_strong tests strong-mode compliant (Closed)
Patch Set: Created 3 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
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 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 main() { 7 main() {
8 testOperations(); 8 testOperations();
9 } 9 }
10 10
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 Expect.listEquals(subr, 49 Expect.listEquals(subr,
50 reversed.skip(2).toList().reversed.skip(2).toList().reversed.toList()); 50 reversed.skip(2).toList().reversed.skip(2).toList().reversed.toList());
51 51
52 52
53 void testList(List list) { 53 void testList(List list) {
54 var throws = const ThrowMarker(); 54 var throws = const ThrowMarker();
55 var mappedList = new List<int>(list.length); 55 var mappedList = new List<int>(list.length);
56 for (int i = 0; i < list.length; i++) { 56 for (int i = 0; i < list.length; i++) {
57 mappedList[i] = rev(list[i]); 57 mappedList[i] = rev(list[i]);
58 } 58 }
59 Iterable reversed = list.map(rev); 59 Iterable<int> reversed = list.map(rev);
60 60
61 void testEquals(v1, v2, path) { 61 void testEquals(v1, v2, path) {
62 if (v1 is Iterable) { 62 if (v1 is Iterable) {
63 Iterator i1 = v1.iterator; 63 Iterator i1 = v1.iterator;
64 Iterator i2 = v2.iterator; 64 Iterator i2 = v2.iterator;
65 int index = 0; 65 int index = 0;
66 while (i1.moveNext()) { 66 while (i1.moveNext()) {
67 Expect.isTrue(i2.moveNext(), 67 Expect.isTrue(i2.moveNext(),
68 "Too few actual values. Expected[$index] == ${i1.current}"); 68 "Too few actual values. Expected[$index] == ${i1.current}");
69 testEquals(i1.current, i2.current, "$path[$index]"); 69 testEquals(i1.current, i2.current, "$path[$index]");
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 testList([0, 1, 2, 3]); 155 testList([0, 1, 2, 3]);
156 testList([3, 4, 5, 6]); 156 testList([3, 4, 5, 6]);
157 testList([10, 11, 12, 13]); 157 testList([10, 11, 12, 13]);
158 testList(l); 158 testList(l);
159 testList(r); 159 testList(r);
160 testList(base); 160 testList(base);
161 161
162 // Reverse const list. 162 // Reverse const list.
163 Expect.listEquals(r, l.map(rev).toList()); 163 Expect.listEquals(r, l.map(rev).toList());
164 } 164 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698