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

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

Issue 2615473002: Signal an error for File.length on a directory (Closed)
Patch Set: Fix windows error code 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 8a8d6811ec21c4dd8c9dd6b1d74ec5d004885473..0e632025ffd0005e13b1027a77c64d39d76ea890 100644
--- a/tests/standalone/io/file_test.dart
+++ b/tests/standalone/io/file_test.dart
@@ -642,6 +642,23 @@ class FileTest {
openedFile.closeSync();
}
+ static void testLengthSyncDirectory() {
+ Directory tmp = tempDirectory.createTempSync('file_length_test_');
+ String dirPath = '${tmp.path}/dir';
+ new Directory(dirPath).createSync();
+ try {
+ new File(dirPath).lengthSync();
+ 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 for file position functionality.
static void testPosition() {
asyncTestStarted();
@@ -1428,6 +1445,7 @@ class FileTest {
createTempDirectory(() {
testLength();
+ testLengthSyncDirectory();
testReadWrite();
testReadWriteSync();
testReadWriteNoArgsSync();
« 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