| Index: tests/standalone/io/directory_invalid_arguments_test.dart
|
| diff --git a/tests/standalone/io/directory_invalid_arguments_test.dart b/tests/standalone/io/directory_invalid_arguments_test.dart
|
| index 029eccd2cc1918bde23acb34d97830309035628c..54cdfdaa1a98e5c335c1675412990e291636fd39 100644
|
| --- a/tests/standalone/io/directory_invalid_arguments_test.dart
|
| +++ b/tests/standalone/io/directory_invalid_arguments_test.dart
|
| @@ -3,55 +3,52 @@
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| import "dart:io";
|
| +import "dart:isolate";
|
|
|
| -class DirectoryInvalidArgumentsTest {
|
| - static void testFailingList(Directory d, var recursive) {
|
| - int errors = 0;
|
| - var lister = d.list(recursive: recursive);
|
| - lister.onError = (error) {
|
| +void testFailingList(Directory d, var recursive) {
|
| + var port = new ReceivePort();
|
| + int errors = 0;
|
| + d.list(recursive: recursive).listen(
|
| + () => Expect.fail("Unexpected listing result"),
|
| + onError: (error) {
|
| errors += 1;
|
| - };
|
| - lister.onDone = (completed) {
|
| + },
|
| + onDone: () {
|
| + port.close();
|
| Expect.equals(1, errors);
|
| - Expect.isFalse(completed);
|
| - };
|
| - Expect.equals(0, errors);
|
| - }
|
| + });
|
| + Expect.equals(0, errors);
|
| +}
|
|
|
| - static void testInvalidArguments() {
|
| - Directory d = new Directory(12);
|
| - try {
|
| - d.existsSync();
|
| - Expect.fail("No exception thrown");
|
| - } catch (e) {
|
| - Expect.isTrue(e is ArgumentError);
|
| - }
|
| - try {
|
| - d.deleteSync();
|
| - Expect.fail("No exception thrown");
|
| - } catch (e) {
|
| - Expect.isTrue(e is ArgumentError);
|
| - }
|
| - try {
|
| - d.createSync();
|
| - Expect.fail("No exception thrown");
|
| - } catch (e) {
|
| - Expect.isTrue(e is ArgumentError);
|
| - }
|
| - testFailingList(d, false);
|
| - Expect.throws(() => d.listSync(recursive: true),
|
| - (e) => e is ArgumentError);
|
| - d = new Directory(".");
|
| - testFailingList(d, 1);
|
| - Expect.throws(() => d.listSync(recursive: 1),
|
| - (e) => e is ArgumentError);
|
| +void testInvalidArguments() {
|
| + Directory d = new Directory(12);
|
| + try {
|
| + d.existsSync();
|
| + Expect.fail("No exception thrown");
|
| + } catch (e) {
|
| + Expect.isTrue(e is ArgumentError);
|
| }
|
| -
|
| - static void testMain() {
|
| - testInvalidArguments();
|
| + try {
|
| + d.deleteSync();
|
| + Expect.fail("No exception thrown");
|
| + } catch (e) {
|
| + Expect.isTrue(e is ArgumentError);
|
| + }
|
| + try {
|
| + d.createSync();
|
| + Expect.fail("No exception thrown");
|
| + } catch (e) {
|
| + Expect.isTrue(e is ArgumentError);
|
| }
|
| + testFailingList(d, false);
|
| + Expect.throws(() => d.listSync(recursive: true),
|
| + (e) => e is ArgumentError);
|
| + d = new Directory(".");
|
| + testFailingList(d, 1);
|
| + Expect.throws(() => d.listSync(recursive: 1),
|
| + (e) => e is ArgumentError);
|
| }
|
|
|
| main() {
|
| - DirectoryInvalidArgumentsTest.testMain();
|
| + testInvalidArguments();
|
| }
|
|
|