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

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

Issue 11821012: Get more pub tests working. (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
« sdk/lib/async/future.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 816 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(null);
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(" ").add(failure).add("\n"); 837 error.add(" $failure\n");
838 } 838 }
839 completer.completeException( 839 completer.completeError(
840 new ExpectException(error.toString()), stackTrace); 840 new ExpectException(error.toString()), stackTrace);
841 } 841 }
842 842
843 for (var match in matches) { 843 for (var match in matches) {
844 var future = validate(match); 844 var future = validate(match);
845 845
846 future.catchError((e) { 846 future.catchError((e) {
847 failures.add(e); 847 failures.add(e);
848 checkComplete(); 848 checkComplete();
849 }); 849 });
850 850
851 future.then((_) { 851 future.then((_) {
852 successes++; 852 successes++;
853 checkComplete(); 853 checkComplete();
854 }).catchError(() {}); 854 }).catchError((_) {});
855 } 855 }
856 return completer.future; 856 return completer.future;
857 }); 857 });
858 } 858 }
859 } 859 }
860 860
861 /// Describes a file. These are used both for setting up an expected directory 861 /// Describes a file. These are used both for setting up an expected directory
862 /// tree before running a test, and for validating that the file system matches 862 /// tree before running a test, and for validating that the file system matches
863 /// some expectations after running it. 863 /// some expectations after running it.
864 class FileDescriptor extends Descriptor { 864 class FileDescriptor extends Descriptor {
(...skipping 686 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
« sdk/lib/async/future.dart ('K') | « utils/pub/utils.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698