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

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

Issue 11557008: Make pub publish more user friendly: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Merge in path changes. Created 8 years 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
« no previous file with comments | « utils/tests/pub/pub_lish_test.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 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 return server.url.chain((url) { 622 return server.url.chain((url) {
623 var tokenEndpoint = url.resolve('/token'); 623 var tokenEndpoint = url.resolve('/token');
624 if (args == null) args = []; 624 if (args == null) args = [];
625 args = flatten(['lish', '--server', url.toString(), args]); 625 args = flatten(['lish', '--server', url.toString(), args]);
626 return _doPub(startProcess, sandboxDir, args, tokenEndpoint); 626 return _doPub(startProcess, sandboxDir, args, tokenEndpoint);
627 }); 627 });
628 }); 628 });
629 return new ScheduledProcess("pub lish", process); 629 return new ScheduledProcess("pub lish", process);
630 } 630 }
631 631
632 /// Handles the beginning confirmation process for uploading a packages.
633 /// Ensures that the right output is shown and then enters "y" to confirm the
634 /// upload.
635 void confirmPublish(ScheduledProcess pub) {
636 // TODO(rnystrom): This is overly specific and inflexible regarding different
637 // test packages. Should validate this a little more loosely.
638 expectLater(pub.nextLine(), equals('Publishing "test_pkg" 1.0.0:'));
639 expectLater(pub.nextLine(), equals("|-- LICENSE"));
640 expectLater(pub.nextLine(), equals("|-- lib"));
641 expectLater(pub.nextLine(), equals("| '-- test_pkg.dart"));
642 expectLater(pub.nextLine(), equals("'-- pubspec.yaml"));
643 expectLater(pub.nextLine(), equals(""));
644
645 pub.writeLine("y");
646 }
647
648
632 /// Calls [fn] with appropriately modified arguments to run a pub process. [fn] 649 /// Calls [fn] with appropriately modified arguments to run a pub process. [fn]
633 /// should have the same signature as [startProcess], except that the returned 650 /// should have the same signature as [startProcess], except that the returned
634 /// [Future] may have a type other than [Process]. 651 /// [Future] may have a type other than [Process].
635 Future _doPub(Function fn, sandboxDir, List<String> args, Uri tokenEndpoint) { 652 Future _doPub(Function fn, sandboxDir, List<String> args, Uri tokenEndpoint) {
636 String pathInSandbox(path) => join(getFullPath(sandboxDir), path); 653 String pathInSandbox(path) => join(getFullPath(sandboxDir), path);
637 654
638 return ensureDir(pathInSandbox(appPath)).chain((_) { 655 return ensureDir(pathInSandbox(appPath)).chain((_) {
639 // Find a Dart executable we can use to spawn. Use the same one that was 656 // Find a Dart executable we can use to spawn. Use the same one that was
640 // used to run this script itself. 657 // used to run this script itself.
641 var dartBin = new Options().executable; 658 var dartBin = new Options().executable;
(...skipping 999 matching lines...) Expand 10 before | Expand all | Expand 10 after
1641 /// calling [completion] is unnecessary. 1658 /// calling [completion] is unnecessary.
1642 void expectLater(Future actual, matcher, {String reason, 1659 void expectLater(Future actual, matcher, {String reason,
1643 FailureHandler failureHandler, bool verbose: false}) { 1660 FailureHandler failureHandler, bool verbose: false}) {
1644 _schedule((_) { 1661 _schedule((_) {
1645 return actual.transform((value) { 1662 return actual.transform((value) {
1646 expect(value, matcher, reason: reason, failureHandler: failureHandler, 1663 expect(value, matcher, reason: reason, failureHandler: failureHandler,
1647 verbose: false); 1664 verbose: false);
1648 }); 1665 });
1649 }); 1666 });
1650 } 1667 }
OLDNEW
« no previous file with comments | « utils/tests/pub/pub_lish_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698