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

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

Issue 12086062: Rename mappedBy to map. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Undo change to test-script. 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
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | tests/corelib/iterable_length_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class IC { 5 class IC {
6 int count = 0; 6 int count = 0;
7 String toString() => "${count++}"; 7 String toString() => "${count++}";
8 } 8 }
9 9
10 testJoin(String expect, Iterable iterable, [String separator]) { 10 testJoin(String expect, Iterable iterable, [String separator]) {
(...skipping 24 matching lines...) Expand all
35 testJoin("0,1,2,3", [ic, ic, ic, ic], ","); 35 testJoin("0,1,2,3", [ic, ic, ic, ic], ",");
36 36
37 var set = new Set()..add(1)..add(2)..add(3); 37 var set = new Set()..add(1)..add(2)..add(3);
38 var perm = new Set()..add("123")..add("132")..add("213") 38 var perm = new Set()..add("123")..add("132")..add("213")
39 ..add("231")..add("312")..add("321"); 39 ..add("231")..add("312")..add("321");
40 var setString = set.join(); 40 var setString = set.join();
41 Expect.isTrue(perm.contains(setString), "set: $setString"); 41 Expect.isTrue(perm.contains(setString), "set: $setString");
42 42
43 void testArray(array) { 43 void testArray(array) {
44 testJoin("1,3,5,7,9", array.where((i) => i.isOdd), ","); 44 testJoin("1,3,5,7,9", array.where((i) => i.isOdd), ",");
45 testJoin("0,2,4,6,8,10,12,14,16,18", array.mappedBy((i) => i * 2), ","); 45 testJoin("0,2,4,6,8,10,12,14,16,18", array.map((i) => i * 2), ",");
46 testJoin("5,6,7,8,9", array.skip(5), ","); 46 testJoin("5,6,7,8,9", array.skip(5), ",");
47 testJoin("5,6,7,8,9", array.skipWhile((i) => i < 5), ","); 47 testJoin("5,6,7,8,9", array.skipWhile((i) => i < 5), ",");
48 testJoin("0,1,2,3,4", array.take(5), ","); 48 testJoin("0,1,2,3,4", array.take(5), ",");
49 testJoin("0,1,2,3,4", array.takeWhile((i) => i < 5), ","); 49 testJoin("0,1,2,3,4", array.takeWhile((i) => i < 5), ",");
50 } 50 }
51 testArray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); 51 testArray([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
52 var fixedArray = new List.fixedLength(10); 52 var fixedArray = new List.fixedLength(10);
53 for (int i = 0; i < 10; i++) { 53 for (int i = 0; i < 10; i++) {
54 fixedArray[i] = i; 54 fixedArray[i] = i;
55 } 55 }
56 testArray(fixedArray); 56 testArray(fixedArray);
57 testArray(const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); 57 testArray(const [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
58 } 58 }
59 59
60 main() { 60 main() {
61 testCollections(); 61 testCollections();
62 // TODO(lrn): test scalar lists. 62 // TODO(lrn): test scalar lists.
63 } 63 }
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/type_checker_test.dart ('k') | tests/corelib/iterable_length_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698