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

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

Issue 12316036: Merge IO v2 branch to bleeding edge (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebased to r18818 Created 7 years, 10 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 | « tests/standalone/io/directory_fuzz_test.dart ('k') | tests/standalone/io/directory_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« no previous file with comments | « tests/standalone/io/directory_fuzz_test.dart ('k') | tests/standalone/io/directory_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698