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

Side by Side Diff: tests/standalone/io/directory_invalid_arguments_test.dart

Issue 23886004: Update dart:io tests to use asyncStart/asyncEnd (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed review comments Created 7 years, 3 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "dart:io";
6
7 import "package:async_helper/async_helper.dart";
5 import "package:expect/expect.dart"; 8 import "package:expect/expect.dart";
6 import "dart:io";
7 import "dart:isolate";
8 9
9 void testFailingList(Directory d, var recursive) { 10 void testFailingList(Directory d, var recursive) {
10 var port = new ReceivePort(); 11 asyncStart();
11 int errors = 0; 12 int errors = 0;
12 d.list(recursive: recursive).listen( 13 d.list(recursive: recursive).listen(
13 () => Expect.fail("Unexpected listing result"), 14 () => Expect.fail("Unexpected listing result"),
14 onError: (error) { 15 onError: (error) {
15 errors += 1; 16 errors += 1;
16 }, 17 },
17 onDone: () { 18 onDone: () {
18 port.close();
19 Expect.equals(1, errors); 19 Expect.equals(1, errors);
20 asyncEnd();
20 }); 21 });
21 Expect.equals(0, errors); 22 Expect.equals(0, errors);
22 } 23 }
23 24
24 void testInvalidArguments() { 25 void testInvalidArguments() {
25 try { 26 try {
26 Directory d = new Directory(12); 27 Directory d = new Directory(12);
27 Expect.fail("No exception thrown"); 28 Expect.fail("No exception thrown");
28 } catch (e) { 29 } catch (e) {
29 Expect.isTrue(e is ArgumentError); 30 Expect.isTrue(e is ArgumentError);
30 } 31 }
31 Directory d = new Directory("."); 32 Directory d = new Directory(".");
32 testFailingList(d, 1); 33 testFailingList(d, 1);
33 Expect.throws(() => d.listSync(recursive: 1), 34 Expect.throws(() => d.listSync(recursive: 1),
34 (e) => e is ArgumentError); 35 (e) => e is ArgumentError);
35 } 36 }
36 37
37 main() { 38 main() {
38 testInvalidArguments(); 39 testInvalidArguments();
39 } 40 }
OLDNEW
« no previous file with comments | « tests/standalone/io/directory_fuzz_test.dart ('k') | tests/standalone/io/directory_list_nonexistent_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698