| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 379 var sourceName = only(keys); | 379 var sourceName = only(keys); |
| 380 var source; | 380 var source; |
| 381 switch (sourceName) { | 381 switch (sourceName) { |
| 382 case "git": | 382 case "git": |
| 383 source = new GitSource(); | 383 source = new GitSource(); |
| 384 break; | 384 break; |
| 385 case "hosted": | 385 case "hosted": |
| 386 source = new HostedSource(); | 386 source = new HostedSource(); |
| 387 break; | 387 break; |
| 388 case "sdk": | 388 case "sdk": |
| 389 source = new SdkSource(''); | 389 source = new SdkSource(); |
| 390 break; | 390 break; |
| 391 default: | 391 default: |
| 392 throw 'Unknown source "$sourceName"'; | 392 throw 'Unknown source "$sourceName"'; |
| 393 } | 393 } |
| 394 | 394 |
| 395 result[_packageName(sourceName, dependency[sourceName])] = dependency; | 395 result[_packageName(sourceName, dependency[sourceName])] = dependency; |
| 396 } | 396 } |
| 397 return result; | 397 return result; |
| 398 }); | 398 }); |
| 399 } | 399 } |
| (...skipping 759 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1159 | 1159 |
| 1160 /// A function that creates a [Validator] subclass. | 1160 /// A function that creates a [Validator] subclass. |
| 1161 typedef Validator ValidatorCreator(Entrypoint entrypoint); | 1161 typedef Validator ValidatorCreator(Entrypoint entrypoint); |
| 1162 | 1162 |
| 1163 /// Schedules a single [Validator] to run on the [appPath]. Returns a scheduled | 1163 /// Schedules a single [Validator] to run on the [appPath]. Returns a scheduled |
| 1164 /// Future that contains the erros and warnings produced by that validator. | 1164 /// Future that contains the erros and warnings produced by that validator. |
| 1165 Future<Pair<List<String>, List<String>>> schedulePackageValidation( | 1165 Future<Pair<List<String>, List<String>>> schedulePackageValidation( |
| 1166 ValidatorCreator fn) { | 1166 ValidatorCreator fn) { |
| 1167 return _scheduleValue((sandboxDir) { | 1167 return _scheduleValue((sandboxDir) { |
| 1168 var cache = new SystemCache.withSources( | 1168 var cache = new SystemCache.withSources( |
| 1169 join(sandboxDir, cachePath), | 1169 join(sandboxDir, cachePath)); |
| 1170 join(sandboxDir, sdkPath)); | |
| 1171 | 1170 |
| 1172 return Entrypoint.load(join(sandboxDir, appPath), cache) | 1171 return Entrypoint.load(join(sandboxDir, appPath), cache) |
| 1173 .then((entrypoint) { | 1172 .then((entrypoint) { |
| 1174 var validator = fn(entrypoint); | 1173 var validator = fn(entrypoint); |
| 1175 return validator.validate().then((_) { | 1174 return validator.validate().then((_) { |
| 1176 return new Pair(validator.errors, validator.warnings); | 1175 return new Pair(validator.errors, validator.warnings); |
| 1177 }); | 1176 }); |
| 1178 }); | 1177 }); |
| 1179 }); | 1178 }); |
| 1180 } | 1179 } |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1557 /// calling [completion] is unnecessary. | 1556 /// calling [completion] is unnecessary. |
| 1558 void expectLater(Future actual, matcher, {String reason, | 1557 void expectLater(Future actual, matcher, {String reason, |
| 1559 FailureHandler failureHandler, bool verbose: false}) { | 1558 FailureHandler failureHandler, bool verbose: false}) { |
| 1560 _schedule((_) { | 1559 _schedule((_) { |
| 1561 return actual.then((value) { | 1560 return actual.then((value) { |
| 1562 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1561 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
| 1563 verbose: false); | 1562 verbose: false); |
| 1564 }); | 1563 }); |
| 1565 }); | 1564 }); |
| 1566 } | 1565 } |
| OLD | NEW |