OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 library fletch_tests.utils; | 5 library dartino_tests.utils; |
6 | 6 |
7 import 'dart:async' show | 7 import 'dart:async' show |
8 Future; | 8 Future; |
9 | 9 |
10 import 'dart:io' show | 10 import 'dart:io' show |
11 Directory; | 11 Directory; |
12 | 12 |
13 Future withTempDirectory(Future f(Directory)) async { | 13 Future withTempDirectory(Future f(Directory)) async { |
14 var directory = await Directory.systemTemp.createTemp(); | 14 var directory = await Directory.systemTemp.createTemp(); |
15 try { | 15 try { |
16 return await f(directory); | 16 return await f(directory); |
17 } finally { | 17 } finally { |
18 await directory.delete(recursive: true); | 18 await directory.delete(recursive: true); |
19 } | 19 } |
20 } | 20 } |
21 | 21 |
OLD | NEW |