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

Unified Diff: tests/standalone/io/file_test.dart

Issue 2616463004: Signal an error for File.lastModified on a directory (Closed)
Patch Set: Created 3 years, 12 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/standalone/io/file_test.dart
diff --git a/tests/standalone/io/file_test.dart b/tests/standalone/io/file_test.dart
index 0e632025ffd0005e13b1027a77c64d39d76ea890..73db86b6e50dc64adaab231c66bf68b700d255ee 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -1268,6 +1268,23 @@ class FileTest {
Expect.isTrue(modified.isBefore(new DateTime.now()));
}
+ static void testLastModifiedSyncDirectory() {
+ Directory tmp = tempDirectory.createTempSync('file_last_modified_test_');
+ String dirPath = '${tmp.path}/dir';
+ new Directory(dirPath).createSync();
+ try {
+ new File(dirPath).lastModifiedSync();
+ Expect.fail('Expected operation to throw');
+ } catch (e) {
+ if (e is! FileSystemException) {
+ print(e);
+ }
+ Expect.isTrue(e is FileSystemException);
+ } finally {
+ tmp.deleteSync(recursive: true);
+ }
+ }
+
// Test that opens the same file for writing then for appending to test
// that the file is not truncated when opened for appending.
static void testAppend() {
@@ -1484,6 +1501,7 @@ class FileTest {
testRename(targetExists: true);
testRenameSync(targetExists: true);
testLastModified();
+ testLastModifiedSyncDirectory();
testDoubleAsyncOperation();
asyncEnd();
});
« no previous file with comments | « runtime/bin/file_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698