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 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
562 openedFile.writeList(new MyListOfOneElement(262), 0, 1); | 562 openedFile.writeList(new MyListOfOneElement(262), 0, 1); |
563 x = 12345678901234567890123456789012345678901234567890; | 563 x = 12345678901234567890123456789012345678901234567890; |
564 y = 12345678901234567890123456789012345678901234568153; | 564 y = 12345678901234567890123456789012345678901234568153; |
565 openedFile.writeList([y - x], 0, 1).then((ignore) { | 565 openedFile.writeList([y - x], 0, 1).then((ignore) { |
566 openedFile.close().then((ignore) { | 566 openedFile.close().then((ignore) { |
567 // Check the written bytes. | 567 // Check the written bytes. |
568 final File file2 = new File(fileName); | 568 final File file2 = new File(fileName); |
569 var openedFile2 = file2.openSync(); | 569 var openedFile2 = file2.openSync(); |
570 var length = openedFile2.lengthSync(); | 570 var length = openedFile2.lengthSync(); |
571 Expect.equals(8, length); | 571 Expect.equals(8, length); |
572 List data = new List(length); | 572 List data = new List.fixedLength(length); |
573 openedFile2.readListSync(data, 0, length); | 573 openedFile2.readListSync(data, 0, length); |
574 for (var i = 0; i < data.length; i++) { | 574 for (var i = 0; i < data.length; i++) { |
575 Expect.equals(i, data[i]); | 575 Expect.equals(i, data[i]); |
576 } | 576 } |
577 openedFile2.closeSync(); | 577 openedFile2.closeSync(); |
578 file2.deleteSync(); | 578 file2.deleteSync(); |
579 asyncTestDone("testWriteVariousLists"); | 579 asyncTestDone("testWriteVariousLists"); |
580 }); | 580 }); |
581 }); | 581 }); |
582 }); | 582 }); |
(...skipping 736 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1319 testDirectorySync(); | 1319 testDirectorySync(); |
1320 testWriteStringUtf8(); | 1320 testWriteStringUtf8(); |
1321 testWriteStringUtf8Sync(); | 1321 testWriteStringUtf8Sync(); |
1322 }); | 1322 }); |
1323 } | 1323 } |
1324 } | 1324 } |
1325 | 1325 |
1326 main() { | 1326 main() { |
1327 FileTest.testMain(); | 1327 FileTest.testMain(); |
1328 } | 1328 } |
OLD | NEW |