| 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. | 5 /// Test infrastructure for testing pub. | 
| 6 /// | 6 /// | 
| 7 /// Unlike typical unit tests, most pub tests are integration tests that stage | 7 /// Unlike typical unit tests, most pub tests are integration tests that stage | 
| 8 /// some stuff on the file system, run pub, and then validate the results. This | 8 /// some stuff on the file system, run pub, and then validate the results. This | 
| 9 /// library provides an API to build tests like that. | 9 /// library provides an API to build tests like that. | 
| 10 library test_pub; | 10 library test_pub; | 
| (...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 457 } | 457 } | 
| 458 | 458 | 
| 459 /// Handles the beginning confirmation process for uploading a packages. | 459 /// Handles the beginning confirmation process for uploading a packages. | 
| 460 /// | 460 /// | 
| 461 /// Ensures that the right output is shown and then enters "y" to confirm the | 461 /// Ensures that the right output is shown and then enters "y" to confirm the | 
| 462 /// upload. | 462 /// upload. | 
| 463 void confirmPublish(ScheduledProcess pub) { | 463 void confirmPublish(ScheduledProcess pub) { | 
| 464   // TODO(rnystrom): This is overly specific and inflexible regarding different | 464   // TODO(rnystrom): This is overly specific and inflexible regarding different | 
| 465   // test packages. Should validate this a little more loosely. | 465   // test packages. Should validate this a little more loosely. | 
| 466   pub.stdout.expect(startsWith('Publishing test_pkg 1.0.0 to ')); | 466   pub.stdout.expect(startsWith('Publishing test_pkg 1.0.0 to ')); | 
| 467   pub.stdout.expect(emitsLines( | 467   pub.stdout.expect(consumeThrough( | 
| 468       "|-- LICENSE\n" |  | 
| 469       "|-- lib\n" |  | 
| 470       "|   '-- test_pkg.dart\n" |  | 
| 471       "'-- pubspec.yaml\n" |  | 
| 472       "\n" |  | 
| 473       "Looks great! Are you ready to upload your package (y/n)?")); | 468       "Looks great! Are you ready to upload your package (y/n)?")); | 
| 474   pub.writeLine("y"); | 469   pub.writeLine("y"); | 
| 475 } | 470 } | 
| 476 | 471 | 
| 477 /// Gets the absolute path to [relPath], which is a relative path in the test | 472 /// Gets the absolute path to [relPath], which is a relative path in the test | 
| 478 /// sandbox. | 473 /// sandbox. | 
| 479 String _pathInSandbox(String relPath) { | 474 String _pathInSandbox(String relPath) { | 
| 480   return p.join(p.absolute(sandboxDir), relPath); | 475   return p.join(p.absolute(sandboxDir), relPath); | 
| 481 } | 476 } | 
| 482 | 477 | 
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 972         _lastMatcher.matches(item.last, matchState); | 967         _lastMatcher.matches(item.last, matchState); | 
| 973   } | 968   } | 
| 974 | 969 | 
| 975   Description describe(Description description) { | 970   Description describe(Description description) { | 
| 976     return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 971     return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 
| 977   } | 972   } | 
| 978 } | 973 } | 
| 979 | 974 | 
| 980 /// A [StreamMatcher] that matches multiple lines of output. | 975 /// A [StreamMatcher] that matches multiple lines of output. | 
| 981 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 976 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 
| OLD | NEW | 
|---|