| 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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 449 | 449 |
| 450 /** | 450 /** |
| 451 * Schedules the directory to be validated after Pub is run with [runPub]. The | 451 * Schedules the directory to be validated after Pub is run with [runPub]. The |
| 452 * directory will be validated relative to the sandbox directory. | 452 * directory will be validated relative to the sandbox directory. |
| 453 */ | 453 */ |
| 454 void scheduleValidate() => _schedule((parentDir) => validate(parentDir.path)); | 454 void scheduleValidate() => _schedule((parentDir) => validate(parentDir.path)); |
| 455 | 455 |
| 456 /** | 456 /** |
| 457 * Asserts that the name of the descriptor is a [String] and returns it. | 457 * Asserts that the name of the descriptor is a [String] and returns it. |
| 458 */ | 458 */ |
| 459 String get _stringName() { | 459 String get _stringName { |
| 460 if (name is String) return name; | 460 if (name is String) return name; |
| 461 throw 'Pattern $name must be a string.'; | 461 throw 'Pattern $name must be a string.'; |
| 462 } | 462 } |
| 463 | 463 |
| 464 /** | 464 /** |
| 465 * Validates that at least one file in [dir] matching [name] is valid | 465 * Validates that at least one file in [dir] matching [name] is valid |
| 466 * according to [validate]. [validate] should complete to an exception if the | 466 * according to [validate]. [validate] should complete to an exception if the |
| 467 * input path is invalid. | 467 * input path is invalid. |
| 468 */ | 468 */ |
| 469 Future _validateOneMatch(String dir, Future validate(String path)) { | 469 Future _validateOneMatch(String dir, Future validate(String path)) { |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 } | 812 } |
| 813 | 813 |
| 814 /** | 814 /** |
| 815 * Schedules a callback to be called after Pub is run with [runPub], even if it | 815 * Schedules a callback to be called after Pub is run with [runPub], even if it |
| 816 * fails. | 816 * fails. |
| 817 */ | 817 */ |
| 818 void _scheduleCleanup(_ScheduledEvent event) { | 818 void _scheduleCleanup(_ScheduledEvent event) { |
| 819 if (_scheduledCleanup == null) _scheduledCleanup = []; | 819 if (_scheduledCleanup == null) _scheduledCleanup = []; |
| 820 _scheduledCleanup.add(event); | 820 _scheduledCleanup.add(event); |
| 821 } | 821 } |
| OLD | NEW |