| 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 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 971 /// A function that creates a [Validator] subclass. | 971 /// A function that creates a [Validator] subclass. |
| 972 typedef Validator ValidatorCreator(Entrypoint entrypoint); | 972 typedef Validator ValidatorCreator(Entrypoint entrypoint); |
| 973 | 973 |
| 974 /// Schedules a single [Validator] to run on the [appPath]. | 974 /// Schedules a single [Validator] to run on the [appPath]. |
| 975 /// | 975 /// |
| 976 /// Returns a scheduled Future that contains the errors and warnings produced | 976 /// Returns a scheduled Future that contains the errors and warnings produced |
| 977 /// by that validator. | 977 /// by that validator. |
| 978 Future<Pair<List<String>, List<String>>> | 978 Future<Pair<List<String>, List<String>>> |
| 979 schedulePackageValidation(ValidatorCreator fn) { | 979 schedulePackageValidation(ValidatorCreator fn) { |
| 980 return schedule(() { | 980 return schedule(() { |
| 981 var cache = new SystemCache.withSources(p.join(sandboxDir, cachePath)); | 981 var cache = |
| 982 new SystemCache.withSources(rootDir: p.join(sandboxDir, cachePath)); |
| 982 | 983 |
| 983 return new Future.sync(() { | 984 return new Future.sync(() { |
| 984 var validator = fn(new Entrypoint(p.join(sandboxDir, appPath), cache)); | 985 var validator = fn(new Entrypoint(p.join(sandboxDir, appPath), cache)); |
| 985 return validator.validate().then((_) { | 986 return validator.validate().then((_) { |
| 986 return new Pair(validator.errors, validator.warnings); | 987 return new Pair(validator.errors, validator.warnings); |
| 987 }); | 988 }); |
| 988 }); | 989 }); |
| 989 }, "validating package"); | 990 }, "validating package"); |
| 990 } | 991 } |
| 991 | 992 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 1005 _lastMatcher.matches(item.last, matchState); | 1006 _lastMatcher.matches(item.last, matchState); |
| 1006 } | 1007 } |
| 1007 | 1008 |
| 1008 Description describe(Description description) { | 1009 Description describe(Description description) { |
| 1009 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 1010 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
| 1010 } | 1011 } |
| 1011 } | 1012 } |
| 1012 | 1013 |
| 1013 /// A [StreamMatcher] that matches multiple lines of output. | 1014 /// A [StreamMatcher] that matches multiple lines of output. |
| 1014 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 1015 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); |
| OLD | NEW |