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

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

Issue 11783052: Fix chainToCompleter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 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 | Annotate | Revision Log
« utils/pub/utils.dart ('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 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub 5 /// Test infrastructure for testing pub. Unlike typical unit tests, most pub
6 /// tests are integration tests that stage some stuff on the file system, run 6 /// tests are integration tests that stage some stuff on the file system, run
7 /// pub, and then validate the results. This library provides an API to build 7 /// pub, and then validate the results. This library provides an API to build
8 /// tests like that. 8 /// tests like that.
9 library test_pub; 9 library test_pub;
10 10
(...skipping 809 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 Expect.fail('No files in $dir match pattern $name.'); 820 Expect.fail('No files in $dir match pattern $name.');
821 } 821 }
822 if (matches.length == 1) return validate(matches[0]); 822 if (matches.length == 1) return validate(matches[0]);
823 823
824 var failures = []; 824 var failures = [];
825 var successes = 0; 825 var successes = 0;
826 var completer = new Completer(); 826 var completer = new Completer();
827 checkComplete() { 827 checkComplete() {
828 if (failures.length + successes != matches.length) return; 828 if (failures.length + successes != matches.length) return;
829 if (successes > 0) { 829 if (successes > 0) {
830 completer.complete(null); 830 completer.complete();
831 return; 831 return;
832 } 832 }
833 833
834 var error = new StringBuffer(); 834 var error = new StringBuffer();
835 error.add("No files named $name in $dir were valid:\n"); 835 error.add("No files named $name in $dir were valid:\n");
836 for (var failure in failures) { 836 for (var failure in failures) {
837 error.add(" $failure\n"); 837 error.add(" $failure\n");
838 } 838 }
839 completer.completeError( 839 completer.completeError(
840 new ExpectException(error.toString()), stackTrace); 840 new ExpectException(error.toString()), stackTrace);
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after
1551 /// calling [completion] is unnecessary. 1551 /// calling [completion] is unnecessary.
1552 void expectLater(Future actual, matcher, {String reason, 1552 void expectLater(Future actual, matcher, {String reason,
1553 FailureHandler failureHandler, bool verbose: false}) { 1553 FailureHandler failureHandler, bool verbose: false}) {
1554 _schedule((_) { 1554 _schedule((_) {
1555 return actual.then((value) { 1555 return actual.then((value) {
1556 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1556 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1557 verbose: false); 1557 verbose: false);
1558 }); 1558 });
1559 }); 1559 });
1560 } 1560 }
OLDNEW
« utils/pub/utils.dart ('K') | « utils/pub/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698