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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 var pubPath = fs.joinPaths(testDirectory, '../../pub/pub.dart'); | 344 var pubPath = fs.joinPaths(testDirectory, '../../pub/pub.dart'); |
345 | 345 |
346 var dartArgs = ['--checked', pubPath, '--trace']; | 346 var dartArgs = ['--checked', pubPath, '--trace']; |
347 dartArgs.addAll(args); | 347 dartArgs.addAll(args); |
348 | 348 |
349 if (tokenEndpoint == null) tokenEndpoint = new Future.immediate(null); | 349 if (tokenEndpoint == null) tokenEndpoint = new Future.immediate(null); |
350 var optionsFuture = tokenEndpoint.then((tokenEndpoint) { | 350 var optionsFuture = tokenEndpoint.then((tokenEndpoint) { |
351 var options = new ProcessOptions(); | 351 var options = new ProcessOptions(); |
352 options.workingDirectory = pathInSandbox(appPath); | 352 options.workingDirectory = pathInSandbox(appPath); |
353 // TODO(nweiz): remove this when issue 9294 is fixed. | 353 // TODO(nweiz): remove this when issue 9294 is fixed. |
354 options.environment = new Map(Platform.environment); | 354 options.environment = new Map.from(Platform.environment); |
355 options.environment['PUB_CACHE'] = pathInSandbox(cachePath); | 355 options.environment['PUB_CACHE'] = pathInSandbox(cachePath); |
356 options.environment['DART_SDK'] = pathInSandbox(sdkPath); | 356 options.environment['DART_SDK'] = pathInSandbox(sdkPath); |
357 if (tokenEndpoint != null) { | 357 if (tokenEndpoint != null) { |
358 options.environment['_PUB_TEST_TOKEN_ENDPOINT'] = | 358 options.environment['_PUB_TEST_TOKEN_ENDPOINT'] = |
359 tokenEndpoint.toString(); | 359 tokenEndpoint.toString(); |
360 } | 360 } |
361 return options; | 361 return options; |
362 }); | 362 }); |
363 | 363 |
364 return new ScheduledProcess.start(dartBin, dartArgs, options: optionsFuture, | 364 return new ScheduledProcess.start(dartBin, dartArgs, options: optionsFuture, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
577 bool matches(item, MatchState matchState) { | 577 bool matches(item, MatchState matchState) { |
578 if (item is! Pair) return false; | 578 if (item is! Pair) return false; |
579 return _firstMatcher.matches(item.first, matchState) && | 579 return _firstMatcher.matches(item.first, matchState) && |
580 _lastMatcher.matches(item.last, matchState); | 580 _lastMatcher.matches(item.last, matchState); |
581 } | 581 } |
582 | 582 |
583 Description describe(Description description) { | 583 Description describe(Description description) { |
584 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 584 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
585 } | 585 } |
586 } | 586 } |
OLD | NEW |