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 // Dart test program for testing file I/O. | 5 // Dart test program for testing file I/O. |
6 | 6 |
7 #import("dart:io"); | 7 #import("dart:io"); |
8 #import("dart:isolate"); | 8 #import("dart:isolate"); |
9 | 9 |
10 class MyListOfOneElement implements List { | 10 class MyListOfOneElement implements List { |
(...skipping 18 matching lines...) Expand all Loading... |
29 } | 29 } |
30 | 30 |
31 static void createTempDirectory(Function doNext) { | 31 static void createTempDirectory(Function doNext) { |
32 new Directory('').createTemp().then((temp) { | 32 new Directory('').createTemp().then((temp) { |
33 tempDirectory = temp; | 33 tempDirectory = temp; |
34 doNext(); | 34 doNext(); |
35 }); | 35 }); |
36 } | 36 } |
37 | 37 |
38 static void deleteTempDirectory() { | 38 static void deleteTempDirectory() { |
39 tempDirectory.deleteRecursivelySync(); | 39 tempDirectory.deleteSync(recursive: true); |
40 } | 40 } |
41 | 41 |
42 // Test for file read functionality. | 42 // Test for file read functionality. |
43 static void testReadStream() { | 43 static void testReadStream() { |
44 // Read a file and check part of it's contents. | 44 // Read a file and check part of it's contents. |
45 String filename = getFilename("bin/file_test.cc"); | 45 String filename = getFilename("bin/file_test.cc"); |
46 File file = new File(filename); | 46 File file = new File(filename); |
47 InputStream input = file.openInputStream(); | 47 InputStream input = file.openInputStream(); |
48 input.onData = () { | 48 input.onData = () { |
49 List<int> buffer = new List<int>(42); | 49 List<int> buffer = new List<int>(42); |
(...skipping 1278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1328 testDirectorySync(); | 1328 testDirectorySync(); |
1329 testWriteStringUtf8(); | 1329 testWriteStringUtf8(); |
1330 testWriteStringUtf8Sync(); | 1330 testWriteStringUtf8Sync(); |
1331 }); | 1331 }); |
1332 } | 1332 } |
1333 } | 1333 } |
1334 | 1334 |
1335 main() { | 1335 main() { |
1336 FileTest.testMain(); | 1336 FileTest.testMain(); |
1337 } | 1337 } |
OLD | NEW |