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 unittest.io; | 5 library unittest.io; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:io'; | 8 import 'dart:io'; |
9 import 'dart:isolate'; | |
kevmoo
2015/02/19 01:54:08
It seems like all of the new imports are unused.
nweiz
2015/02/19 02:10:18
Done.
| |
10 | |
11 import 'exit_codes.dart' as exit_codes; | |
12 import 'remote_exception.dart'; | |
9 | 13 |
10 /// Whether "special" strings such as Unicode characters or color escapes are | 14 /// Whether "special" strings such as Unicode characters or color escapes are |
11 /// safe to use. | 15 /// safe to use. |
12 /// | 16 /// |
13 /// On Windows or when not printing to a terminal, only printable ASCII | 17 /// On Windows or when not printing to a terminal, only printable ASCII |
14 /// characters should be used. | 18 /// characters should be used. |
15 bool get canUseSpecialChars => | 19 bool get canUseSpecialChars => |
16 Platform.operatingSystem != 'windows' && | 20 Platform.operatingSystem != 'windows' && |
17 stdioType(stdout) == StdioType.TERMINAL; | 21 stdioType(stdout) == StdioType.TERMINAL; |
18 | 22 |
(...skipping 14 matching lines...) Expand all Loading... | |
33 /// [fn] completes to. | 37 /// [fn] completes to. |
34 Future withTempDir(Future fn(String path)) { | 38 Future withTempDir(Future fn(String path)) { |
35 return new Future.sync(() { | 39 return new Future.sync(() { |
36 // TODO(nweiz): Empirically test whether sync or async functions perform | 40 // TODO(nweiz): Empirically test whether sync or async functions perform |
37 // better here when starting a bunch of isolates. | 41 // better here when starting a bunch of isolates. |
38 var tempDir = Directory.systemTemp.createTempSync('unittest_'); | 42 var tempDir = Directory.systemTemp.createTempSync('unittest_'); |
39 return new Future.sync(() => fn(tempDir.path)) | 43 return new Future.sync(() => fn(tempDir.path)) |
40 .whenComplete(() => tempDir.deleteSync(recursive: true)); | 44 .whenComplete(() => tempDir.deleteSync(recursive: true)); |
41 }); | 45 }); |
42 } | 46 } |
OLD | NEW |