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 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
945 /// A function that creates a [Validator] subclass. | 945 /// A function that creates a [Validator] subclass. |
946 typedef Validator ValidatorCreator(Entrypoint entrypoint); | 946 typedef Validator ValidatorCreator(Entrypoint entrypoint); |
947 | 947 |
948 /// Schedules a single [Validator] to run on the [appPath]. | 948 /// Schedules a single [Validator] to run on the [appPath]. |
949 /// | 949 /// |
950 /// Returns a scheduled Future that contains the errors and warnings produced | 950 /// Returns a scheduled Future that contains the errors and warnings produced |
951 /// by that validator. | 951 /// by that validator. |
952 Future<Pair<List<String>, List<String>>> schedulePackageValidation( | 952 Future<Pair<List<String>, List<String>>> schedulePackageValidation( |
953 ValidatorCreator fn) { | 953 ValidatorCreator fn) { |
954 return schedule(() { | 954 return schedule(() { |
955 var cache = new SystemCache.withSources(p.join(sandboxDir, cachePath)); | 955 var cache = new SystemCache.withSources( |
| 956 rootDir: p.join(sandboxDir, cachePath)); |
956 | 957 |
957 return new Future.sync(() { | 958 return new Future.sync(() { |
958 var validator = fn(new Entrypoint(p.join(sandboxDir, appPath), cache)); | 959 var validator = fn(new Entrypoint(p.join(sandboxDir, appPath), cache)); |
959 return validator.validate().then((_) { | 960 return validator.validate().then((_) { |
960 return new Pair(validator.errors, validator.warnings); | 961 return new Pair(validator.errors, validator.warnings); |
961 }); | 962 }); |
962 }); | 963 }); |
963 }, "validating package"); | 964 }, "validating package"); |
964 } | 965 } |
965 | 966 |
(...skipping 13 matching lines...) Expand all Loading... |
979 _lastMatcher.matches(item.last, matchState); | 980 _lastMatcher.matches(item.last, matchState); |
980 } | 981 } |
981 | 982 |
982 Description describe(Description description) { | 983 Description describe(Description description) { |
983 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 984 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
984 } | 985 } |
985 } | 986 } |
986 | 987 |
987 /// A [StreamMatcher] that matches multiple lines of output. | 988 /// A [StreamMatcher] that matches multiple lines of output. |
988 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 989 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); |
OLD | NEW |