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

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

Issue 3000543002: Migrate test block 11 to Dart 2.0. (Closed)
Patch Set: Fix merge problems and update test status with head changes Created 3 years, 4 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
« no previous file with comments | « tests/corelib/iterable_last_where_test.dart ('k') | tests/corelib/iterable_mapping_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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 import "dart:collection";
6 import "package:expect/expect.dart";
7
8 class A extends IterableBase {
9 int count;
10 A(this.count);
11
12 Iterator get iterator {
13 return new AIterator(count);
14 }
15 }
16
17 class AIterator implements Iterator {
18 int _count;
19 int _current;
20
21 AIterator(this._count);
22
23 bool moveNext() {
24 if (_count > 0) {
25 _current = _count;
26 _count--;
27 return true;
28 }
29 _current = null;
30 return false;
31 }
32
33 get current => _current;
34 }
35
36 main() {
37 var a = new A(10);
38 Expect.equals(10, a.length);
39 a = new A(0);
40 Expect.equals(0, a.length);
41 a = new A(5);
42 Expect.equals(5, a.map((e) => e + 1).length);
43 Expect.equals(3, a.where((e) => e >= 3).length);
44 }
OLDNEW
« no previous file with comments | « tests/corelib/iterable_last_where_test.dart ('k') | tests/corelib/iterable_mapping_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698