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 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 | 348 |
349 ensureDir(pathInSandbox(appPath)); | 349 ensureDir(pathInSandbox(appPath)); |
350 | 350 |
351 // Find a Dart executable we can use to spawn. Use the same one that was | 351 // Find a Dart executable we can use to spawn. Use the same one that was |
352 // used to run this script itself. | 352 // used to run this script itself. |
353 var dartBin = new Options().executable; | 353 var dartBin = new Options().executable; |
354 | 354 |
355 // If the executable looks like a path, get its full path. That way we | 355 // If the executable looks like a path, get its full path. That way we |
356 // can still find it when we spawn it with a different working directory. | 356 // can still find it when we spawn it with a different working directory. |
357 if (dartBin.contains(Platform.pathSeparator)) { | 357 if (dartBin.contains(Platform.pathSeparator)) { |
358 dartBin = new File(dartBin).fullPathSync(); | 358 dartBin = path.absolute(dartBin); |
359 } | 359 } |
360 | 360 |
361 // Find the main pub entrypoint. | 361 // Find the main pub entrypoint. |
362 var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart'); | 362 var pubPath = path.join(testDirectory, '..', 'bin', 'pub.dart'); |
363 | 363 |
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(); |
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 bool matches(item, MatchState matchState) { | 611 bool matches(item, MatchState matchState) { |
612 if (item is! Pair) return false; | 612 if (item is! Pair) return false; |
613 return _firstMatcher.matches(item.first, matchState) && | 613 return _firstMatcher.matches(item.first, matchState) && |
614 _lastMatcher.matches(item.last, matchState); | 614 _lastMatcher.matches(item.last, matchState); |
615 } | 615 } |
616 | 616 |
617 Description describe(Description description) { | 617 Description describe(Description description) { |
618 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 618 description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
619 } | 619 } |
620 } | 620 } |
OLD | NEW |