OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 return startPub(args: args, tokenEndpoint: tokenEndpoint); | 428 return startPub(args: args, tokenEndpoint: tokenEndpoint); |
429 } | 429 } |
430 | 430 |
431 /// Handles the beginning confirmation process for uploading a packages. | 431 /// Handles the beginning confirmation process for uploading a packages. |
432 /// Ensures that the right output is shown and then enters "y" to confirm the | 432 /// Ensures that the right output is shown and then enters "y" to confirm the |
433 /// upload. | 433 /// upload. |
434 void confirmPublish(ScheduledProcess pub) { | 434 void confirmPublish(ScheduledProcess pub) { |
435 // TODO(rnystrom): This is overly specific and inflexible regarding different | 435 // TODO(rnystrom): This is overly specific and inflexible regarding different |
436 // test packages. Should validate this a little more loosely. | 436 // test packages. Should validate this a little more loosely. |
437 expect(pub.nextLine(), completion(startsWith( | 437 expect(pub.nextLine(), completion(startsWith( |
438 'Publishing "test_pkg" 1.0.0 to '))); | 438 'Publishing test_pkg 1.0.0 to '))); |
439 expect(pub.nextLine(), completion(equals("|-- LICENSE"))); | 439 expect(pub.nextLine(), completion(equals("|-- LICENSE"))); |
440 expect(pub.nextLine(), completion(equals("|-- lib"))); | 440 expect(pub.nextLine(), completion(equals("|-- lib"))); |
441 expect(pub.nextLine(), completion(equals("| '-- test_pkg.dart"))); | 441 expect(pub.nextLine(), completion(equals("| '-- test_pkg.dart"))); |
442 expect(pub.nextLine(), completion(equals("'-- pubspec.yaml"))); | 442 expect(pub.nextLine(), completion(equals("'-- pubspec.yaml"))); |
443 expect(pub.nextLine(), completion(equals(""))); | 443 expect(pub.nextLine(), completion(equals(""))); |
444 expect(pub.nextLine(), completion(equals('Looks great! Are you ready to ' | 444 expect(pub.nextLine(), completion(equals('Looks great! Are you ready to ' |
445 'upload your package (y/n)?'))); | 445 'upload your package (y/n)?'))); |
446 | 446 |
447 pub.writeLine("y"); | 447 pub.writeLine("y"); |
448 } | 448 } |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 bool matches(item, Map matchState) { | 859 bool matches(item, Map matchState) { |
860 if (item is! Pair) return false; | 860 if (item is! Pair) return false; |
861 return _firstMatcher.matches(item.first, matchState) && | 861 return _firstMatcher.matches(item.first, matchState) && |
862 _lastMatcher.matches(item.last, matchState); | 862 _lastMatcher.matches(item.last, matchState); |
863 } | 863 } |
864 | 864 |
865 Description describe(Description description) { | 865 Description describe(Description description) { |
866 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 866 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
867 } | 867 } |
868 } | 868 } |
OLD | NEW |