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

Unified Diff: tests/standalone/src/DirectoryInvalidArgumentsTest.dart

Issue 8417023: Add type checks to directory listing. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 9 years, 2 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
Index: tests/standalone/src/DirectoryInvalidArgumentsTest.dart
diff --git a/tests/standalone/src/DirectoryInvalidArgumentsTest.dart b/tests/standalone/src/DirectoryInvalidArgumentsTest.dart
new file mode 100644
index 0000000000000000000000000000000000000000..01d1bb005c9467e0445c0d9aeac617657ca8bc0b
--- /dev/null
+++ b/tests/standalone/src/DirectoryInvalidArgumentsTest.dart
@@ -0,0 +1,42 @@
+class DirectoryInvalidArgumentsTest {
+ static void testFailingList(Directory d, var recursive) {
+ int errors = 0;
+ d.setErrorHandler((error) {
+ errors += 1;
+ });
+ d.setDoneHandler((completed) {
+ Expect.equals(1, errors);
+ Expect.isFalse(completed);
+ });
+ Expect.equals(0, errors);
+ d.list(recursive);
+ }
+
+ static void testInvalidArguments() {
+ Directory d = new Directory(12);
+ Expect.isFalse(d.exists());
+ try {
+ d.delete();
+ Expect.fail("No exception thrown");
+ } catch (var e) {
+ Expect.isTrue(e is DirectoryException);
+ }
+ try {
+ d.create();
+ Expect.fail("No exception thrown");
+ } catch (var e) {
+ Expect.isTrue(e is DirectoryException);
+ }
+ testFailingList(d, false);
+ d = new Directory(".");
+ testFailingList(d, 1);
+ }
+
+ static void testMain() {
+ testInvalidArguments();
+ }
+}
+
+main() {
+ DirectoryInvalidArgumentsTest.testMain();
+}

Powered by Google App Engine
This is Rietveld 408576698