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 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
446 | 446 |
447 // Find the main pub entrypoint. | 447 // Find the main pub entrypoint. |
448 var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart'); | 448 var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart'); |
449 | 449 |
450 var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath, | 450 var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath, |
451 '--verbose']; | 451 '--verbose']; |
452 dartArgs.addAll(args); | 452 dartArgs.addAll(args); |
453 | 453 |
454 if (tokenEndpoint == null) tokenEndpoint = new Future.value(); | 454 if (tokenEndpoint == null) tokenEndpoint = new Future.value(); |
455 var environmentFuture = tokenEndpoint.then((tokenEndpoint) { | 455 var environmentFuture = tokenEndpoint.then((tokenEndpoint) { |
456 // TODO(nweiz): remove this when issue 9294 is fixed. | 456 var environment = {}; |
457 var environment = new Map.from(Platform.environment); | |
458 environment['_PUB_TESTING'] = 'true'; | 457 environment['_PUB_TESTING'] = 'true'; |
459 environment['PUB_CACHE'] = pathInSandbox(cachePath); | 458 environment['PUB_CACHE'] = pathInSandbox(cachePath); |
460 environment['DART_SDK'] = pathInSandbox(sdkPath); | 459 environment['DART_SDK'] = pathInSandbox(sdkPath); |
461 if (tokenEndpoint != null) { | 460 if (tokenEndpoint != null) { |
462 environment['_PUB_TEST_TOKEN_ENDPOINT'] = | 461 environment['_PUB_TEST_TOKEN_ENDPOINT'] = |
463 tokenEndpoint.toString(); | 462 tokenEndpoint.toString(); |
464 } | 463 } |
465 return environment; | 464 return environment; |
466 }); | 465 }); |
467 | 466 |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 bool matches(item, Map matchState) { | 794 bool matches(item, Map matchState) { |
796 if (item is! Pair) return false; | 795 if (item is! Pair) return false; |
797 return _firstMatcher.matches(item.first, matchState) && | 796 return _firstMatcher.matches(item.first, matchState) && |
798 _lastMatcher.matches(item.last, matchState); | 797 _lastMatcher.matches(item.last, matchState); |
799 } | 798 } |
800 | 799 |
801 Description describe(Description description) { | 800 Description describe(Description description) { |
802 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 801 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
803 } | 802 } |
804 } | 803 } |
OLD | NEW |