| 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 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 219 bytesRead = input.readInto(inputBuffer, offset: position, | 219 bytesRead = input.readInto(inputBuffer, offset: position, |
| 220 len: inputBuffer.length - position); | 220 len: inputBuffer.length - position); |
| 221 position += bytesRead; | 221 position += bytesRead; |
| 222 // The buffer is large enough to hold all available data. | 222 // The buffer is large enough to hold all available data. |
| 223 // So there should be no data left to read. | 223 // So there should be no data left to read. |
| 224 Expect.equals(0, input.available()); | 224 Expect.equals(0, input.available()); |
| 225 bytesRead = input.readInto(inputBuffer, offset: position, | 225 bytesRead = input.readInto(inputBuffer, offset: position, |
| 226 len: expectedLength - position); | 226 len: expectedLength - position); |
| 227 Expect.equals(0, bytesRead); | 227 Expect.equals(0, bytesRead); |
| 228 Expect.equals(0, input.available()); | 228 Expect.equals(0, input.available()); |
| 229 Expect.isFalse(input.closed); |
| 229 }; | 230 }; |
| 230 input.onClosed = () { | 231 input.onClosed = () { |
| 231 Expect.equals(0, input.available()); | 232 Expect.equals(0, input.available()); |
| 232 Expect.isTrue(input.closed); | 233 Expect.isTrue(input.closed); |
| 233 input.close(); // This should be safe to call. | 234 input.close(); // This should be safe to call. |
| 234 | 235 |
| 235 Expect.equals(expectedLength, position); | 236 Expect.equals(expectedLength, position); |
| 236 for (int i = 0; i < position; ++i) { | 237 for (int i = 0; i < position; ++i) { |
| 237 Expect.equals(buffer[i % buffer.length], inputBuffer[i]); | 238 Expect.equals(buffer[i % buffer.length], inputBuffer[i]); |
| 238 } | 239 } |
| (...skipping 977 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1216 testWriteVariousLists(); | 1217 testWriteVariousLists(); |
| 1217 testDirectory(); | 1218 testDirectory(); |
| 1218 testDirectorySync(); | 1219 testDirectorySync(); |
| 1219 }); | 1220 }); |
| 1220 } | 1221 } |
| 1221 } | 1222 } |
| 1222 | 1223 |
| 1223 main() { | 1224 main() { |
| 1224 FileTest.testMain(); | 1225 FileTest.testMain(); |
| 1225 } | 1226 } |
| OLD | NEW |