OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 "package:expect/expect.dart"; | 7 import "package:expect/expect.dart"; |
8 import 'dart:async'; | 8 import 'dart:async'; |
9 import 'dart:collection'; | 9 import 'dart:collection'; |
10 import 'dart:io'; | 10 import 'dart:io'; |
(...skipping 1088 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1099 readAsLinesFuture.then((lines) => Expect.fail("no lines expected")) | 1099 readAsLinesFuture.then((lines) => Expect.fail("no lines expected")) |
1100 .catchError((e) { | 1100 .catchError((e) { |
1101 port.toSendPort().send(1); | 1101 port.toSendPort().send(1); |
1102 }); | 1102 }); |
1103 }); | 1103 }); |
1104 }); | 1104 }); |
1105 } | 1105 } |
1106 | 1106 |
1107 static void testLastModified() { | 1107 static void testLastModified() { |
1108 var port = new ReceivePort(); | 1108 var port = new ReceivePort(); |
1109 new File(new Options().executable).lastModified().then((modified) { | 1109 new File(Platform.executable).lastModified().then((modified) { |
1110 Expect.isTrue(modified is DateTime); | 1110 Expect.isTrue(modified is DateTime); |
1111 Expect.isTrue(modified.isBefore(new DateTime.now())); | 1111 Expect.isTrue(modified.isBefore(new DateTime.now())); |
1112 port.close(); | 1112 port.close(); |
1113 }); | 1113 }); |
1114 } | 1114 } |
1115 | 1115 |
1116 static void testLastModifiedSync() { | 1116 static void testLastModifiedSync() { |
1117 var modified = new File(new Options().executable).lastModifiedSync(); | 1117 var modified = new File(Platform.executable).lastModifiedSync(); |
1118 Expect.isTrue(modified is DateTime); | 1118 Expect.isTrue(modified is DateTime); |
1119 Expect.isTrue(modified.isBefore(new DateTime.now())); | 1119 Expect.isTrue(modified.isBefore(new DateTime.now())); |
1120 } | 1120 } |
1121 | 1121 |
1122 // Test that opens the same file for writing then for appending to test | 1122 // Test that opens the same file for writing then for appending to test |
1123 // that the file is not truncated when opened for appending. | 1123 // that the file is not truncated when opened for appending. |
1124 static void testAppend() { | 1124 static void testAppend() { |
1125 var file = new File('${tempDirectory.path}/out_append'); | 1125 var file = new File('${tempDirectory.path}/out_append'); |
1126 file.open(mode: WRITE).then((openedFile) { | 1126 file.open(mode: WRITE).then((openedFile) { |
1127 openedFile.writeString("asdf").then((ignore) { | 1127 openedFile.writeString("asdf").then((ignore) { |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1331 testWriteStringUtf8Sync(); | 1331 testWriteStringUtf8Sync(); |
1332 testRename(); | 1332 testRename(); |
1333 testRenameSync(); | 1333 testRenameSync(); |
1334 }); | 1334 }); |
1335 } | 1335 } |
1336 } | 1336 } |
1337 | 1337 |
1338 main() { | 1338 main() { |
1339 FileTest.testMain(); | 1339 FileTest.testMain(); |
1340 } | 1340 } |
OLD | NEW |