OLD | NEW |
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 List<int> list1 = <int>[1, 2, 3]; | 8 List<int> list1 = <int>[1, 2, 3]; |
9 List<int> list2 = const <int>[4, 5]; | 9 List<int> list2 = const <int>[4, 5]; |
10 List<String> list3 = <String>[]; | 10 List<String> list3 = <String>[]; |
11 Set<int> set1 = new Set<int>(); | 11 Set<int> set1 = new Set<int>(); |
12 set1..add(11) | 12 set1..add(11)..add(12)..add(13); |
13 ..add(12) | |
14 ..add(13); | |
15 Set set2 = new Set(); | 13 Set set2 = new Set(); |
16 | 14 |
17 Iterable<int> takeWhileFalse = list1.takeWhile((x) => false); | 15 Iterable<int> takeWhileFalse = list1.takeWhile((x) => false); |
18 Iterator<int> it = takeWhileFalse.iterator; | 16 Iterator<int> it = takeWhileFalse.iterator; |
19 Expect.isNull(it.current); | 17 Expect.isNull(it.current); |
20 Expect.isFalse(it.moveNext()); | 18 Expect.isFalse(it.moveNext()); |
21 Expect.isNull(it.current); | 19 Expect.isNull(it.current); |
22 | 20 |
23 Iterable<int> takeWhileOdd = list1.takeWhile((x) => x.isOdd); | 21 Iterable<int> takeWhileOdd = list1.takeWhile((x) => x.isOdd); |
24 it = takeWhileOdd.iterator; | 22 it = takeWhileOdd.iterator; |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 Expect.isNull(it.current); | 121 Expect.isNull(it.current); |
124 Expect.isFalse(it.moveNext()); | 122 Expect.isFalse(it.moveNext()); |
125 Expect.isNull(it.current); | 123 Expect.isNull(it.current); |
126 | 124 |
127 takeEverything = set2.takeWhile((x) => true); | 125 takeEverything = set2.takeWhile((x) => true); |
128 it = takeEverything.iterator; | 126 it = takeEverything.iterator; |
129 Expect.isNull(it.current); | 127 Expect.isNull(it.current); |
130 Expect.isFalse(it.moveNext()); | 128 Expect.isFalse(it.moveNext()); |
131 Expect.isNull(it.current); | 129 Expect.isNull(it.current); |
132 } | 130 } |
OLD | NEW |