| 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 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1129 } | 1129 } |
| 1130 | 1130 |
| 1131 var sinkStream = new ListInputStream(); | 1131 var sinkStream = new ListInputStream(); |
| 1132 var tempDir; | 1132 var tempDir; |
| 1133 // TODO(nweiz): propagate any errors to the return value. See issue 3657. | 1133 // TODO(nweiz): propagate any errors to the return value. See issue 3657. |
| 1134 createTempDir().chain((_tempDir) { | 1134 createTempDir().chain((_tempDir) { |
| 1135 tempDir = _tempDir; | 1135 tempDir = _tempDir; |
| 1136 return create(tempDir); | 1136 return create(tempDir); |
| 1137 }).then((tar) { | 1137 }).then((tar) { |
| 1138 var sourceStream = tar.openInputStream(); | 1138 var sourceStream = tar.openInputStream(); |
| 1139 pipeInputToInput( | 1139 pipeInputToInput(sourceStream, sinkStream, tempDir.deleteRecursively); |
| 1140 sourceStream, sinkStream, onClosed: tempDir.deleteRecursively); | |
| 1141 }); | 1140 }); |
| 1142 return sinkStream; | 1141 return sinkStream; |
| 1143 } | 1142 } |
| 1144 } | 1143 } |
| 1145 | 1144 |
| 1146 /** | 1145 /** |
| 1147 * A descriptor that validates that no file exists with the given name. | 1146 * A descriptor that validates that no file exists with the given name. |
| 1148 */ | 1147 */ |
| 1149 class NothingDescriptor extends Descriptor { | 1148 class NothingDescriptor extends Descriptor { |
| 1150 NothingDescriptor(String name) : super(name); | 1149 NothingDescriptor(String name) : super(name); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 } | 1201 } |
| 1203 | 1202 |
| 1204 /** | 1203 /** |
| 1205 * Schedules a callback to be called after Pub is run with [runPub], even if it | 1204 * Schedules a callback to be called after Pub is run with [runPub], even if it |
| 1206 * fails. | 1205 * fails. |
| 1207 */ | 1206 */ |
| 1208 void _scheduleCleanup(_ScheduledEvent event) { | 1207 void _scheduleCleanup(_ScheduledEvent event) { |
| 1209 if (_scheduledCleanup == null) _scheduledCleanup = []; | 1208 if (_scheduledCleanup == null) _scheduledCleanup = []; |
| 1210 _scheduledCleanup.add(event); | 1209 _scheduledCleanup.add(event); |
| 1211 } | 1210 } |
| OLD | NEW |