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

Side by Side Diff: tests/isolate/static_function_test.dart

Issue 88783002: Isolate.spawn{Uri} only reports errors asynchronously. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years 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
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Test starting isolate with static functions (and toplevel ones, for sanity). 5 // Test starting isolate with static functions (and toplevel ones, for sanity).
6 6
7 library static_function_test; 7 library static_function_test;
8 import 'dart:isolate'; 8 import 'dart:isolate';
9 import 'dart:async'; 9 import 'dart:async';
10 import 'static_function_lib.dart' as lib; 10 import 'static_function_lib.dart' as lib;
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 test(name, () { 63 test(name, () {
64 ReceivePort r = new ReceivePort(); 64 ReceivePort r = new ReceivePort();
65 Isolate.spawn(function, r.sendPort); 65 Isolate.spawn(function, r.sendPort);
66 r.listen(expectAsync1((v) { 66 r.listen(expectAsync1((v) {
67 expect(v, response); 67 expect(v, response);
68 r.close(); 68 r.close();
69 })); 69 }));
70 }); 70 });
71 } 71 }
72 72
73 void throwsTest(name, function) { 73 void functionFailTest(name, function) {
74 test("throws on $name", () { 74 test("throws on $name", () {
75 expect(() { Isolate.spawn(function, null); }, throws); 75 Isolate.spawn(function, null).catchError(expectAsync1((e) {
76 /* do nothing */
77 }));
76 }); 78 });
77 } 79 }
78 80
79 void main([args, port]) { 81 void main([args, port]) {
80 if (testRemote(main, port)) return; 82 if (testRemote(main, port)) return;
81 // Sanity check. 83 // Sanity check.
82 spawnTest("function", function, "TOP"); 84 spawnTest("function", function, "TOP");
83 spawnTest("_function", _function, "_TOP"); 85 spawnTest("_function", _function, "_TOP");
84 spawnTest("lib.function", lib.function, "LIBTOP"); 86 spawnTest("lib.function", lib.function, "LIBTOP");
85 spawnTest("lib._function", lib.privateFunction, "_LIBTOP"); 87 spawnTest("lib._function", lib.privateFunction, "_LIBTOP");
86 88
87 // Local static functions. 89 // Local static functions.
88 spawnTest("class.function", C.function, "YES"); 90 spawnTest("class.function", C.function, "YES");
89 spawnTest("class._function", C._function, "PRIVATE"); 91 spawnTest("class._function", C._function, "PRIVATE");
90 spawnTest("_class._function", _C.function, "_YES"); 92 spawnTest("_class._function", _C.function, "_YES");
91 spawnTest("_class._function", _C._function, "_PRIVATE"); 93 spawnTest("_class._function", _C._function, "_PRIVATE");
92 94
93 // Imported static functions. 95 // Imported static functions.
94 spawnTest("lib.class.function", lib.C.function, "LIB"); 96 spawnTest("lib.class.function", lib.C.function, "LIB");
95 spawnTest("lib.class._function", lib.C.privateFunction, "LIBPRIVATE"); 97 spawnTest("lib.class._function", lib.C.privateFunction, "LIBPRIVATE");
96 spawnTest("lib._class._function", lib.privateClassFunction, "_LIB"); 98 spawnTest("lib._class._function", lib.privateClassFunction, "_LIB");
97 spawnTest("lib._class._function", lib.privateClassAndFunction, "_LIBPRIVATE"); 99 spawnTest("lib._class._function", lib.privateClassAndFunction, "_LIBPRIVATE");
98 100
99 // Negative tests 101 // Negative tests
100 throwsTest("static closure", staticClosure); 102 functionFailTest("static closure", staticClosure);
101 throwsTest("dynamic closure", dynamicClosure); 103 functionFailTest("dynamic closure", dynamicClosure);
102 throwsTest("named dynamic closure", namedDynamicClosure); 104 functionFailTest("named dynamic closure", namedDynamicClosure);
103 throwsTest("instance closure", new C().instanceClosure); 105 functionFailTest("instance closure", new C().instanceClosure);
104 throwsTest("initializer closure", new C().constructorInitializerClosure); 106 functionFailTest("initializer closure",
105 throwsTest("constructor closure", new C().constructorBodyClosure); 107 new C().constructorInitializerClosure);
106 throwsTest("named constructor closure", new C().namedConstructorBodyClosure); 108 functionFailTest("constructor closure", new C().constructorBodyClosure);
107 throwsTest("instance method", new C().instanceMethod); 109 functionFailTest("named constructor closure",
110 new C().namedConstructorBodyClosure);
111 functionFailTest("instance method", new C().instanceMethod);
108 } 112 }
OLDNEW
« no previous file with comments | « tests/co19/co19-runtime.status ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698