| 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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 } | 1018 } |
| 1019 | 1019 |
| 1020 /// Loads [path] from within this directory. | 1020 /// Loads [path] from within this directory. |
| 1021 ByteStream load(List<String> path) { | 1021 ByteStream load(List<String> path) { |
| 1022 if (path.isEmpty) { | 1022 if (path.isEmpty) { |
| 1023 throw "Can't load the contents of $name: is a directory."; | 1023 throw "Can't load the contents of $name: is a directory."; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 for (var descriptor in contents) { | 1026 for (var descriptor in contents) { |
| 1027 if (descriptor.name == path[0]) { | 1027 if (descriptor.name == path[0]) { |
| 1028 return descriptor.load(path.getRange(1, path.length - 1)); | 1028 return descriptor.load(path.sublist(1)); |
| 1029 } | 1029 } |
| 1030 } | 1030 } |
| 1031 | 1031 |
| 1032 throw "Directory $name doesn't contain ${path.join('/')}."; | 1032 throw "Directory $name doesn't contain ${path.join('/')}."; |
| 1033 } | 1033 } |
| 1034 } | 1034 } |
| 1035 | 1035 |
| 1036 /// Wraps a [Future] that will complete to a [Descriptor] and makes it behave | 1036 /// Wraps a [Future] that will complete to a [Descriptor] and makes it behave |
| 1037 /// like a concrete [Descriptor]. This is necessary when the contents of the | 1037 /// like a concrete [Descriptor]. This is necessary when the contents of the |
| 1038 /// descriptor depends on information that's not available until part of the | 1038 /// descriptor depends on information that's not available until part of the |
| (...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1635 /// calling [completion] is unnecessary. | 1635 /// calling [completion] is unnecessary. |
| 1636 void expectLater(Future actual, matcher, {String reason, | 1636 void expectLater(Future actual, matcher, {String reason, |
| 1637 FailureHandler failureHandler, bool verbose: false}) { | 1637 FailureHandler failureHandler, bool verbose: false}) { |
| 1638 _schedule((_) { | 1638 _schedule((_) { |
| 1639 return actual.then((value) { | 1639 return actual.then((value) { |
| 1640 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1640 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
| 1641 verbose: false); | 1641 verbose: false); |
| 1642 }); | 1642 }); |
| 1643 }); | 1643 }); |
| 1644 } | 1644 } |
| OLD | NEW |