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