Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: tests/standalone/io/file_test.dart

Issue 10443008: Implement File.lastModified. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 953 matching lines...) Expand 10 before | Expand all | Expand 10 after
964 readAsLinesFuture.handleException((e) { 964 readAsLinesFuture.handleException((e) {
965 port.toSendPort().send(1); 965 port.toSendPort().send(1);
966 return true; 966 return true;
967 }); 967 });
968 return true; 968 return true;
969 }); 969 });
970 return true; 970 return true;
971 }); 971 });
972 } 972 }
973 973
974 static void testLastModified() {
975 var port = new ReceivePort();
976 new File(new Options().executable).lastModified().then((modified) {
Anders Johnsen 2012/05/24 12:05:42 Cute :)
977 Expect.isTrue(modified is Date);
978 Expect.isTrue(modified < new Date.now());
979 port.close();
980 });
981 }
982
983 static void testLastModifiedSync() {
984 var modified = new File(new Options().executable).lastModifiedSync();
985 Expect.isTrue(modified is Date);
986 Expect.isTrue(modified < new Date.now());
987 }
988
974 // Test that opens the same file for writing then for appending to test 989 // Test that opens the same file for writing then for appending to test
975 // that the file is not truncated when opened for appending. 990 // that the file is not truncated when opened for appending.
976 static void testAppend() { 991 static void testAppend() {
977 var file = new File('${tempDirectory.path}/out_append'); 992 var file = new File('${tempDirectory.path}/out_append');
978 file.open(FileMode.WRITE).then((openedFile) { 993 file.open(FileMode.WRITE).then((openedFile) {
979 openedFile.writeString("asdf").then((ignore) { 994 openedFile.writeString("asdf").then((ignore) {
980 openedFile.close().then((ignore) { 995 openedFile.close().then((ignore) {
981 file.open(FileMode.APPEND).then((openedFile) { 996 file.open(FileMode.APPEND).then((openedFile) {
982 openedFile.length().then((length) { 997 openedFile.length().then((length) {
983 Expect.equals(4, length); 998 Expect.equals(4, length);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1037 testPositionSync(); 1052 testPositionSync();
1038 testOpenDirectoryAsFile(); 1053 testOpenDirectoryAsFile();
1039 testOpenDirectoryAsFileSync(); 1054 testOpenDirectoryAsFileSync();
1040 testReadAsBytes(); 1055 testReadAsBytes();
1041 testReadAsBytesSync(); 1056 testReadAsBytesSync();
1042 testReadAsText(); 1057 testReadAsText();
1043 testReadAsTextSync(); 1058 testReadAsTextSync();
1044 testReadAsLines(); 1059 testReadAsLines();
1045 testReadAsLinesSync(); 1060 testReadAsLinesSync();
1046 testReadAsErrors(); 1061 testReadAsErrors();
1062 testLastModified();
1063 testLastModifiedSync();
1047 1064
1048 createTempDirectory(() { 1065 createTempDirectory(() {
1049 testReadWrite(); 1066 testReadWrite();
1050 testReadWriteSync(); 1067 testReadWriteSync();
1051 testReadWriteStream(); 1068 testReadWriteStream();
1052 testReadEmptyFileSync(); 1069 testReadEmptyFileSync();
1053 testReadEmptyFile(); 1070 testReadEmptyFile();
1054 testTruncate(); 1071 testTruncate();
1055 testTruncateSync(); 1072 testTruncateSync();
1056 testCloseException(); 1073 testCloseException();
1057 testCloseExceptionStream(); 1074 testCloseExceptionStream();
1058 testBufferOutOfBoundsException(); 1075 testBufferOutOfBoundsException();
1059 testAppend(); 1076 testAppend();
1060 testAppendSync(); 1077 testAppendSync();
1061 testWriteAppend(); 1078 testWriteAppend();
1062 testOutputStreamWriteAppend(); 1079 testOutputStreamWriteAppend();
1063 testOutputStreamWriteString(); 1080 testOutputStreamWriteString();
1064 testWriteVariousLists(); 1081 testWriteVariousLists();
1065 testDirectory(); 1082 testDirectory();
1066 testDirectorySync(); 1083 testDirectorySync();
1067 }); 1084 });
1068 } 1085 }
1069 } 1086 }
1070 1087
1071 main() { 1088 main() {
1072 FileTest.testMain(); 1089 FileTest.testMain();
1073 } 1090 }
OLDNEW
« runtime/bin/file_win.cc ('K') | « tests/standalone/io/file_fuzz_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698