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

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: Rebase 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
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 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 throwsTest(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");
(...skipping 13 matching lines...) Expand all
99 // Negative tests 101 // Negative tests
100 throwsTest("static closure", staticClosure); 102 throwsTest("static closure", staticClosure);
101 throwsTest("dynamic closure", dynamicClosure); 103 throwsTest("dynamic closure", dynamicClosure);
102 throwsTest("named dynamic closure", namedDynamicClosure); 104 throwsTest("named dynamic closure", namedDynamicClosure);
103 throwsTest("instance closure", new C().instanceClosure); 105 throwsTest("instance closure", new C().instanceClosure);
104 throwsTest("initializer closure", new C().constructorInitializerClosure); 106 throwsTest("initializer closure", new C().constructorInitializerClosure);
105 throwsTest("constructor closure", new C().constructorBodyClosure); 107 throwsTest("constructor closure", new C().constructorBodyClosure);
106 throwsTest("named constructor closure", new C().namedConstructorBodyClosure); 108 throwsTest("named constructor closure", new C().namedConstructorBodyClosure);
107 throwsTest("instance method", new C().instanceMethod); 109 throwsTest("instance method", new C().instanceMethod);
108 } 110 }
OLDNEW
« runtime/vm/isolate_test.cc ('K') | « sdk/lib/_internal/pub/lib/src/dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698