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

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

Issue 14907002: dart:io | Implement asynchronous versions of FileSystemEntity methods. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add implementation of FileSystemEntity.type, and refactor error handling. Created 7 years, 8 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 | « sdk/lib/io/file_system_entity.dart ('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_invalid_arguments_test.dart
diff --git a/tests/standalone/io/file_invalid_arguments_test.dart b/tests/standalone/io/file_invalid_arguments_test.dart
index 5f7f73f22c11e3dee26d4d5af7cbd7965dc259c1..6d5e040de260819053e3d0d9dba61ee1130d65a8 100644
--- a/tests/standalone/io/file_invalid_arguments_test.dart
+++ b/tests/standalone/io/file_invalid_arguments_test.dart
@@ -130,6 +130,39 @@ void testWriteStringInvalidArgs(string, encoding) {
});
}
+Future futureThrows(Future result) {
+ return result.then((value) {
+ throw new ExpectException(
+ "futureThrows received $value instead of an exception");
+ },
+ onError: (_) => null
+ );
+}
+
+void testFileSystemEntity() {
+ Expect.throws(() => FileSystemEntity.typeSync([1,2,3]));
+ Expect.throws(() =>
+ FileSystemEntity.typeSync(".", followLinks: "why not?"));
+ Expect.throws(() => FileSystemEntity.identicalSync([1,2,3], "."));
+ Expect.throws(() => FileSystemEntity.identicalSync("."));
+ Expect.throws(() => FileSystemEntity.identicalSync(".", 52));
+ Expect.throws(() => FileSystemEntity.isLinkSync(52));
+ Expect.throws(() => FileSystemEntity.isFileSync(52));
+ Expect.throws(() => FileSystemEntity.isDirectorySync(52));
+
+ ReceivePort keepAlive = new ReceivePort();
+ futureThrows(FileSystemEntity.type([1,2,3]))
+ .then((_) => futureThrows(
+ FileSystemEntity.type(".", followLinks: "why not?")))
+ .then((_) => futureThrows(FileSystemEntity.identical([1,2,3], ".")))
+ .then((_) => Expect.throws(() =>FileSystemEntity.identical(".")))
+ .then((_) => futureThrows(FileSystemEntity.identical(".", 52)))
+ .then((_) => futureThrows(FileSystemEntity.isLink(52)))
+ .then((_) => futureThrows(FileSystemEntity.isFile(52)))
+ .then((_) => futureThrows(FileSystemEntity.isDirectory(52)))
+ .then((_) => keepAlive.close());
+}
+
String getFilename(String path) {
return new File(path).existsSync() ? path : 'runtime/$path';
}
@@ -144,4 +177,5 @@ main() {
testWriteFromInvalidArgs(new List(10), '0', 1);
testWriteFromInvalidArgs(new List(10), 0, '1');
testWriteStringInvalidArgs("Hello, world", 42);
+ testFileSystemEntity();
}
« no previous file with comments | « sdk/lib/io/file_system_entity.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698