| 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:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 import 'dart:isolate'; | 9 import 'dart:isolate'; |
| 10 | 10 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 }); | 69 }); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // Test for file read and write functionality. | 72 // Test for file read and write functionality. |
| 73 static void testReadWriteStream() { | 73 static void testReadWriteStream() { |
| 74 asyncTestStarted(); | 74 asyncTestStarted(); |
| 75 | 75 |
| 76 // Read a file. | 76 // Read a file. |
| 77 String inFilename = getFilename("tests/vm/data/fixed_length_file"); | 77 String inFilename = getFilename("tests/vm/data/fixed_length_file"); |
| 78 File file; | 78 File file; |
| 79 InputStream input; | |
| 80 int bytesRead; | 79 int bytesRead; |
| 81 | 80 |
| 82 var file1 = new File(inFilename); | 81 var file1 = new File(inFilename); |
| 83 List<int> buffer = new List<int>(); | 82 List<int> buffer = new List<int>(); |
| 84 file1.openRead().listen( | 83 file1.openRead().listen( |
| 85 (d) { | 84 (d) { |
| 86 buffer.addAll(d); | 85 buffer.addAll(d); |
| 87 }, | 86 }, |
| 88 onDone: () { | 87 onDone: () { |
| 89 Expect.equals(42, buffer.length); | 88 Expect.equals(42, buffer.length); |
| (...skipping 1132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1222 testDirectorySync(); | 1221 testDirectorySync(); |
| 1223 testWriteStringUtf8(); | 1222 testWriteStringUtf8(); |
| 1224 testWriteStringUtf8Sync(); | 1223 testWriteStringUtf8Sync(); |
| 1225 }); | 1224 }); |
| 1226 } | 1225 } |
| 1227 } | 1226 } |
| 1228 | 1227 |
| 1229 main() { | 1228 main() { |
| 1230 FileTest.testMain(); | 1229 FileTest.testMain(); |
| 1231 } | 1230 } |
| OLD | NEW |