| 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();
|
| +}
|
|
|