| 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 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 818 "author": "Natalie Weizenbaum <nweiz@google.com>", | 818 "author": "Natalie Weizenbaum <nweiz@google.com>", |
| 819 "homepage": "http://pub.dartlang.org", | 819 "homepage": "http://pub.dartlang.org", |
| 820 "description": "A package, I guess." | 820 "description": "A package, I guess." |
| 821 }; | 821 }; |
| 822 | 822 |
| 823 if (dependencies != null) package["dependencies"] = dependencies; | 823 if (dependencies != null) package["dependencies"] = dependencies; |
| 824 | 824 |
| 825 return package; | 825 return package; |
| 826 } | 826 } |
| 827 | 827 |
| 828 /// Resolves [target] relative to the path to pub's `test/asset` directory. |
| 829 String testAssetPath(String target) => |
| 830 p.join(p.dirname(libraryPath('test_pub')), 'asset', target); |
| 831 |
| 828 /// Returns a Map in the format used by the pub.dartlang.org API to represent a | 832 /// Returns a Map in the format used by the pub.dartlang.org API to represent a |
| 829 /// package version. | 833 /// package version. |
| 830 /// | 834 /// |
| 831 /// [pubspec] is the parsed pubspec of the package version. If [full] is true, | 835 /// [pubspec] is the parsed pubspec of the package version. If [full] is true, |
| 832 /// this returns the complete map, including metadata that's only included when | 836 /// this returns the complete map, including metadata that's only included when |
| 833 /// requesting the package version directly. | 837 /// requesting the package version directly. |
| 834 Map packageVersionApiMap(Map pubspec, {bool full: false}) { | 838 Map packageVersionApiMap(Map pubspec, {bool full: false}) { |
| 835 var name = pubspec['name']; | 839 var name = pubspec['name']; |
| 836 var version = pubspec['version']; | 840 var version = pubspec['version']; |
| 837 var map = { | 841 var map = { |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 979 _lastMatcher.matches(item.last, matchState); | 983 _lastMatcher.matches(item.last, matchState); |
| 980 } | 984 } |
| 981 | 985 |
| 982 Description describe(Description description) { | 986 Description describe(Description description) { |
| 983 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 987 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
| 984 } | 988 } |
| 985 } | 989 } |
| 986 | 990 |
| 987 /// A [StreamMatcher] that matches multiple lines of output. | 991 /// A [StreamMatcher] that matches multiple lines of output. |
| 988 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 992 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); |
| OLD | NEW |