| OLD | NEW |
| 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.mappedBy((x) => x + 1); | 13 Iterable mapped = list1.map((x) => x + 1); |
| 14 Expect.isTrue(mapped is List); | 14 Expect.listEquals([2, 3, 4], mapped.toList()); |
| 15 Expect.listEquals([2, 3, 4], mapped); | |
| 16 | 15 |
| 17 mapped = mapped.mappedBy((x) => x + 1); | 16 mapped = mapped.map((x) => x + 1); |
| 18 Expect.isTrue(mapped is List); | 17 Expect.listEquals([3, 4, 5], mapped.toList()); |
| 19 Expect.listEquals([3, 4, 5], mapped); | |
| 20 | 18 |
| 21 mapped = list2.mappedBy((x) => x + 1); | 19 mapped = list2.map((x) => x + 1); |
| 22 Expect.isTrue(mapped is List); | 20 Expect.listEquals([5, 6], mapped.toList()); |
| 23 Expect.listEquals([5, 6], mapped); | |
| 24 | 21 |
| 25 mapped = mapped.mappedBy((x) => x + 1); | 22 mapped = mapped.map((x) => x + 1); |
| 26 Expect.isTrue(mapped is List); | 23 Expect.listEquals([6, 7], mapped.toList()); |
| 27 Expect.listEquals([6, 7], mapped); | |
| 28 | 24 |
| 29 mapped = list3.mappedBy((x) => x + 1); | 25 mapped = list3.map((x) => x + 1); |
| 30 Expect.isTrue(mapped is List); | 26 Expect.listEquals([], mapped.toList()); |
| 31 Expect.listEquals([], mapped); | |
| 32 | 27 |
| 33 mapped = mapped.mappedBy((x) => x + 1); | 28 mapped = mapped.map((x) => x + 1); |
| 34 Expect.isTrue(mapped is List); | 29 Expect.listEquals([], mapped.toList()); |
| 35 Expect.listEquals([], mapped); | |
| 36 | 30 |
| 37 var expected = new Set<int>()..addAll([12, 13, 14]); | 31 var expected = new Set<int>()..addAll([12, 13, 14]); |
| 38 mapped = set1.mappedBy((x) => x + 1); | 32 mapped = set1.map((x) => x + 1); |
| 39 Expect.isFalse(mapped is List); | 33 Expect.isFalse(mapped is List); |
| 40 Expect.setEquals(expected, mapped.toSet()); | 34 Expect.setEquals(expected, mapped.toSet()); |
| 41 | 35 |
| 42 expected = new Set<int>()..addAll([13, 14, 15]); | 36 expected = new Set<int>()..addAll([13, 14, 15]); |
| 43 mapped = mapped.mappedBy((x) => x + 1); | 37 mapped = mapped.map((x) => x + 1); |
| 44 Expect.isFalse(mapped is List); | 38 Expect.isFalse(mapped is List); |
| 45 Expect.setEquals(expected, mapped.toSet()); | 39 Expect.setEquals(expected, mapped.toSet()); |
| 46 | 40 |
| 47 mapped = set2.mappedBy((x) => x + 1); | 41 mapped = set2.map((x) => x + 1); |
| 48 Expect.isFalse(mapped is List); | 42 Expect.isFalse(mapped is List); |
| 49 Expect.listEquals([], mapped.toList()); | 43 Expect.listEquals([], mapped.toList()); |
| 50 | 44 |
| 51 mapped = mapped.mappedBy((x) => x + 1); | 45 mapped = mapped.map((x) => x + 1); |
| 52 Expect.isFalse(mapped is List); | 46 Expect.isFalse(mapped is List); |
| 53 Expect.listEquals([], mapped.toList()); | 47 Expect.listEquals([], mapped.toList()); |
| 54 | 48 |
| 55 } | 49 } |
| OLD | NEW |