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

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

Issue 12087103: Revert "Rename mappedBy to map." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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/corelib/iterable_length_test.dart ('k') | tests/corelib/list_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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.addAll([11, 12, 13]); 10 set1.addAll([11, 12, 13]);
11 Set set2 = new Set(); 11 Set set2 = new Set();
12 12
13 Iterable mapped = list1.map((x) => x + 1); 13 Iterable mapped = list1.mappedBy((x) => x + 1);
14 Expect.listEquals([2, 3, 4], mapped.toList()); 14 Expect.isTrue(mapped is List);
15 Expect.listEquals([2, 3, 4], mapped);
15 16
16 mapped = mapped.map((x) => x + 1); 17 mapped = mapped.mappedBy((x) => x + 1);
17 Expect.listEquals([3, 4, 5], mapped.toList()); 18 Expect.isTrue(mapped is List);
19 Expect.listEquals([3, 4, 5], mapped);
18 20
19 mapped = list2.map((x) => x + 1); 21 mapped = list2.mappedBy((x) => x + 1);
20 Expect.listEquals([5, 6], mapped.toList()); 22 Expect.isTrue(mapped is List);
23 Expect.listEquals([5, 6], mapped);
21 24
22 mapped = mapped.map((x) => x + 1); 25 mapped = mapped.mappedBy((x) => x + 1);
23 Expect.listEquals([6, 7], mapped.toList()); 26 Expect.isTrue(mapped is List);
27 Expect.listEquals([6, 7], mapped);
24 28
25 mapped = list3.map((x) => x + 1); 29 mapped = list3.mappedBy((x) => x + 1);
26 Expect.listEquals([], mapped.toList()); 30 Expect.isTrue(mapped is List);
31 Expect.listEquals([], mapped);
27 32
28 mapped = mapped.map((x) => x + 1); 33 mapped = mapped.mappedBy((x) => x + 1);
29 Expect.listEquals([], mapped.toList()); 34 Expect.isTrue(mapped is List);
35 Expect.listEquals([], mapped);
30 36
31 var expected = new Set<int>()..addAll([12, 13, 14]); 37 var expected = new Set<int>()..addAll([12, 13, 14]);
32 mapped = set1.map((x) => x + 1); 38 mapped = set1.mappedBy((x) => x + 1);
33 Expect.isFalse(mapped is List); 39 Expect.isFalse(mapped is List);
34 Expect.setEquals(expected, mapped.toSet()); 40 Expect.setEquals(expected, mapped.toSet());
35 41
36 expected = new Set<int>()..addAll([13, 14, 15]); 42 expected = new Set<int>()..addAll([13, 14, 15]);
37 mapped = mapped.map((x) => x + 1); 43 mapped = mapped.mappedBy((x) => x + 1);
38 Expect.isFalse(mapped is List); 44 Expect.isFalse(mapped is List);
39 Expect.setEquals(expected, mapped.toSet()); 45 Expect.setEquals(expected, mapped.toSet());
40 46
41 mapped = set2.map((x) => x + 1); 47 mapped = set2.mappedBy((x) => x + 1);
42 Expect.isFalse(mapped is List); 48 Expect.isFalse(mapped is List);
43 Expect.listEquals([], mapped.toList()); 49 Expect.listEquals([], mapped.toList());
44 50
45 mapped = mapped.map((x) => x + 1); 51 mapped = mapped.mappedBy((x) => x + 1);
46 Expect.isFalse(mapped is List); 52 Expect.isFalse(mapped is List);
47 Expect.listEquals([], mapped.toList()); 53 Expect.listEquals([], mapped.toList());
48 54
49 } 55 }
OLDNEW
« no previous file with comments | « tests/corelib/iterable_length_test.dart ('k') | tests/corelib/list_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698