OLD | NEW |
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 import 'dart:isolate'; | 5 import 'dart:isolate'; |
6 import "package:unittest/unittest.dart"; | 6 import "package:unittest/unittest.dart"; |
7 import "remote_unittest_helper.dart"; | 7 import "remote_unittest_helper.dart"; |
8 | 8 |
9 void main([args, port]) { | 9 void main([args, port]) { |
10 if (testRemote(main, port)) return; | 10 if (testRemote(main, port)) return; |
11 test("stacktrace_message", () { | 11 test("stacktrace_message", () { |
12 ReceivePort reply = new ReceivePort(); | 12 ReceivePort reply = new ReceivePort(); |
13 Isolate.spawn(runTest, reply.sendPort); | 13 Isolate.spawn(runTest, reply.sendPort); |
14 reply.first.then(expectAsync1((StackTrace stack) { | 14 reply.first.then(expectAsync((StackTrace stack) { |
15 print(stack); | 15 print(stack); |
16 })); | 16 })); |
17 }); | 17 }); |
18 } | 18 } |
19 | 19 |
20 runTest(SendPort sendport) { | 20 runTest(SendPort sendport) { |
21 try { | 21 try { |
22 throw 'sorry'; | 22 throw 'sorry'; |
23 } catch (e, stack) { | 23 } catch (e, stack) { |
24 try { | 24 try { |
25 sendport.send(stack); | 25 sendport.send(stack); |
26 print("Stacktrace sent"); | 26 print("Stacktrace sent"); |
27 } catch (e) { | 27 } catch (e) { |
28 print("Stacktrace not sent"); | 28 print("Stacktrace not sent"); |
29 sendport.send(null); | 29 sendport.send(null); |
30 } | 30 } |
31 } | 31 } |
32 } | 32 } |
OLD | NEW |