| 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 /** | 5 /** |
| 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub | 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub |
| 7 * tests are integration tests that stage some stuff on the file system, run | 7 * tests are integration tests that stage some stuff on the file system, run |
| 8 * pub, and then validate the results. This library provides an API to build | 8 * pub, and then validate the results. This library provides an API to build |
| 9 * tests like that. | 9 * tests like that. |
| 10 */ | 10 */ |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 631 | 631 |
| 632 // If the executable looks like a path, get its full path. That way we | 632 // If the executable looks like a path, get its full path. That way we |
| 633 // can still find it when we spawn it with a different working directory. | 633 // can still find it when we spawn it with a different working directory. |
| 634 if (dartBin.contains(Platform.pathSeparator)) { | 634 if (dartBin.contains(Platform.pathSeparator)) { |
| 635 dartBin = new File(dartBin).fullPathSync(); | 635 dartBin = new File(dartBin).fullPathSync(); |
| 636 } | 636 } |
| 637 | 637 |
| 638 // Find the main pub entrypoint. | 638 // Find the main pub entrypoint. |
| 639 var pubPath = fs.joinPaths(testDirectory, '../../pub/pub.dart'); | 639 var pubPath = fs.joinPaths(testDirectory, '../../pub/pub.dart'); |
| 640 | 640 |
| 641 var dartArgs = | 641 var dartArgs = ['--checked', pubPath, '--trace']; |
| 642 ['--enable-type-checks', '--enable-asserts', pubPath, '--trace']; | |
| 643 dartArgs.addAll(args); | 642 dartArgs.addAll(args); |
| 644 | 643 |
| 645 var environment = { | 644 var environment = { |
| 646 'PUB_CACHE': pathInSandbox(cachePath), | 645 'PUB_CACHE': pathInSandbox(cachePath), |
| 647 'DART_SDK': pathInSandbox(sdkPath) | 646 'DART_SDK': pathInSandbox(sdkPath) |
| 648 }; | 647 }; |
| 648 |
| 649 if (tokenEndpoint != null) { | 649 if (tokenEndpoint != null) { |
| 650 environment['_PUB_TEST_TOKEN_ENDPOINT'] = tokenEndpoint.toString(); | 650 environment['_PUB_TEST_TOKEN_ENDPOINT'] = tokenEndpoint.toString(); |
| 651 } | 651 } |
| 652 | 652 |
| 653 return fn(dartBin, dartArgs, workingDir: pathInSandbox(appPath), | 653 return fn(dartBin, dartArgs, workingDir: pathInSandbox(appPath), |
| 654 environment: environment); | 654 environment: environment); |
| 655 }); | 655 }); |
| 656 } | 656 } |
| 657 | 657 |
| 658 /** | 658 /** |
| (...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1630 /// calling [completion] is unnecessary. | 1630 /// calling [completion] is unnecessary. |
| 1631 void expectLater(Future actual, matcher, {String reason, | 1631 void expectLater(Future actual, matcher, {String reason, |
| 1632 FailureHandler failureHandler, bool verbose: false}) { | 1632 FailureHandler failureHandler, bool verbose: false}) { |
| 1633 _schedule((_) { | 1633 _schedule((_) { |
| 1634 return actual.transform((value) { | 1634 return actual.transform((value) { |
| 1635 expect(value, matcher, reason: reason, failureHandler: failureHandler, | 1635 expect(value, matcher, reason: reason, failureHandler: failureHandler, |
| 1636 verbose: false); | 1636 verbose: false); |
| 1637 }); | 1637 }); |
| 1638 }); | 1638 }); |
| 1639 } | 1639 } |
| OLD | NEW |