| 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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 638 /// validation gives an easier-to-understand error when that requirement isn't | 638 /// validation gives an easier-to-understand error when that requirement isn't |
| 639 /// met than just failing in the middle of a test when pub invokes git. | 639 /// met than just failing in the middle of a test when pub invokes git. |
| 640 /// | 640 /// |
| 641 /// This also increases the [Schedule] timeout to 30 seconds on Windows, | 641 /// This also increases the [Schedule] timeout to 30 seconds on Windows, |
| 642 /// where Git runs really slowly. | 642 /// where Git runs really slowly. |
| 643 void ensureGit() { | 643 void ensureGit() { |
| 644 if (Platform.operatingSystem == "windows") { | 644 if (Platform.operatingSystem == "windows") { |
| 645 currentSchedule.timeout = new Duration(seconds: 30); | 645 currentSchedule.timeout = new Duration(seconds: 30); |
| 646 } | 646 } |
| 647 | 647 |
| 648 schedule(() { | 648 if (!gitlib.isInstalled) { |
| 649 return gitlib.isInstalled.then((installed) { | 649 throw new Exception("Git must be installed to run this test."); |
| 650 if (!installed) { | 650 } |
| 651 throw new Exception("Git must be installed to run this test."); | |
| 652 } | |
| 653 }); | |
| 654 }, 'ensuring that Git is installed'); | |
| 655 } | 651 } |
| 656 | 652 |
| 657 /// Create a lock file for [package] without running `pub get`. | 653 /// Create a lock file for [package] without running `pub get`. |
| 658 /// | 654 /// |
| 659 /// [sandbox] is a list of path dependencies to be found in the sandbox | 655 /// [sandbox] is a list of path dependencies to be found in the sandbox |
| 660 /// directory. [pkg] is a list of packages in the Dart repo's "pkg" directory; | 656 /// directory. [pkg] is a list of packages in the Dart repo's "pkg" directory; |
| 661 /// each package listed here and all its dependencies will be linked to the | 657 /// each package listed here and all its dependencies will be linked to the |
| 662 /// version in the Dart repo. | 658 /// version in the Dart repo. |
| 663 /// | 659 /// |
| 664 /// [hosted] is a list of package names to version strings for dependencies on | 660 /// [hosted] is a list of package names to version strings for dependencies on |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 908 _lastMatcher.matches(item.last, matchState); | 904 _lastMatcher.matches(item.last, matchState); |
| 909 } | 905 } |
| 910 | 906 |
| 911 Description describe(Description description) { | 907 Description describe(Description description) { |
| 912 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 908 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
| 913 } | 909 } |
| 914 } | 910 } |
| 915 | 911 |
| 916 /// A [StreamMatcher] that matches multiple lines of output. | 912 /// A [StreamMatcher] that matches multiple lines of output. |
| 917 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 913 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); |
| OLD | NEW |