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

Side by Side Diff: utils/tests/pub/test_pub.dart

Issue 11410086: Use iterator, moveNext(), current. (Closed) Base URL: https://dart.googlecode.com/svn/experimental/lib_v2/dart
Patch Set: Address comments. Created 8 years, 1 month 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
« runtime/vm/intrinsifier.h ('K') | « utils/pub/utils.dart ('k') | no next file » | 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) 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 /** 5 /**
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub
7 * tests are integration tests that stage some stuff on the file system, run 7 * tests are integration tests that stage some stuff on the file system, run
8 * pub, and then validate the results. This library provides an API to build 8 * pub, and then validate the results. This library provides an API to build
9 * tests like that. 9 * tests like that.
10 */ 10 */
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
598 }); 598 });
599 }); 599 });
600 } 600 }
601 601
602 Future<Directory> _setUpSandbox() { 602 Future<Directory> _setUpSandbox() {
603 return createTempDir(); 603 return createTempDir();
604 } 604 }
605 605
606 Future _runScheduled(Directory parentDir, List<_ScheduledEvent> scheduled) { 606 Future _runScheduled(Directory parentDir, List<_ScheduledEvent> scheduled) {
607 if (scheduled == null) return new Future.immediate(null); 607 if (scheduled == null) return new Future.immediate(null);
608 var iterator = scheduled.iterator(); 608 var iterator = scheduled.iterator;
609 609
610 Future runNextEvent(_) { 610 Future runNextEvent(_) {
611 if (_abortScheduled || !iterator.hasNext) { 611 if (_abortScheduled || !iterator.moveNext()) {
612 _abortScheduled = false; 612 _abortScheduled = false;
613 scheduled.clear(); 613 scheduled.clear();
614 return new Future.immediate(null); 614 return new Future.immediate(null);
615 } 615 }
616 616
617 var future = iterator.next()(parentDir); 617 var future = iterator.current(parentDir);
618 if (future != null) { 618 if (future != null) {
619 return future.chain(runNextEvent); 619 return future.chain(runNextEvent);
620 } else { 620 } else {
621 return runNextEvent(null); 621 return runNextEvent(null);
622 } 622 }
623 } 623 }
624 624
625 return runNextEvent(null); 625 return runNextEvent(null);
626 } 626 }
627 627
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
1224 } 1224 }
1225 1225
1226 /** 1226 /**
1227 * Schedules a callback to be called after Pub is run with [runPub], even if it 1227 * Schedules a callback to be called after Pub is run with [runPub], even if it
1228 * fails. 1228 * fails.
1229 */ 1229 */
1230 void _scheduleCleanup(_ScheduledEvent event) { 1230 void _scheduleCleanup(_ScheduledEvent event) {
1231 if (_scheduledCleanup == null) _scheduledCleanup = []; 1231 if (_scheduledCleanup == null) _scheduledCleanup = [];
1232 _scheduledCleanup.add(event); 1232 _scheduledCleanup.add(event);
1233 } 1233 }
OLDNEW
« runtime/vm/intrinsifier.h ('K') | « utils/pub/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698