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 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath, | 364 var dartArgs = ['--package-root=$_packageRoot/', '--checked', pubPath, |
365 '--trace']; | 365 '--trace']; |
366 dartArgs.addAll(args); | 366 dartArgs.addAll(args); |
367 | 367 |
368 if (tokenEndpoint == null) tokenEndpoint = new Future.value(); | 368 if (tokenEndpoint == null) tokenEndpoint = new Future.value(); |
369 var optionsFuture = tokenEndpoint.then((tokenEndpoint) { | 369 var optionsFuture = tokenEndpoint.then((tokenEndpoint) { |
370 var options = new ProcessOptions(); | 370 var options = new ProcessOptions(); |
371 options.workingDirectory = pathInSandbox(appPath); | 371 options.workingDirectory = pathInSandbox(appPath); |
372 // TODO(nweiz): remove this when issue 9294 is fixed. | 372 // TODO(nweiz): remove this when issue 9294 is fixed. |
373 options.environment = new Map.from(Platform.environment); | 373 options.environment = new Map.from(Platform.environment); |
| 374 options.environment['_PUB_TESTING'] = 'true'; |
374 options.environment['PUB_CACHE'] = pathInSandbox(cachePath); | 375 options.environment['PUB_CACHE'] = pathInSandbox(cachePath); |
375 options.environment['DART_SDK'] = pathInSandbox(sdkPath); | 376 options.environment['DART_SDK'] = pathInSandbox(sdkPath); |
376 if (tokenEndpoint != null) { | 377 if (tokenEndpoint != null) { |
377 options.environment['_PUB_TEST_TOKEN_ENDPOINT'] = | 378 options.environment['_PUB_TEST_TOKEN_ENDPOINT'] = |
378 tokenEndpoint.toString(); | 379 tokenEndpoint.toString(); |
379 } | 380 } |
380 return options; | 381 return options; |
381 }); | 382 }); |
382 | 383 |
383 return new ScheduledProcess.start(dartBin, dartArgs, options: optionsFuture, | 384 return new ScheduledProcess.start(dartBin, dartArgs, options: optionsFuture, |
(...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 bool matches(item, MatchState matchState) { | 612 bool matches(item, MatchState matchState) { |
612 if (item is! Pair) return false; | 613 if (item is! Pair) return false; |
613 return _firstMatcher.matches(item.first, matchState) && | 614 return _firstMatcher.matches(item.first, matchState) && |
614 _lastMatcher.matches(item.last, matchState); | 615 _lastMatcher.matches(item.last, matchState); |
615 } | 616 } |
616 | 617 |
617 Description describe(Description description) { | 618 Description describe(Description description) { |
618 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 619 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
619 } | 620 } |
620 } | 621 } |
OLD | NEW |