OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file |
| 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. |
| 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
| 5 |
| 6 import 'package:observatory/service_io.dart'; |
| 7 import 'package:observatory/models.dart' as M; |
| 8 import 'package:unittest/unittest.dart'; |
| 9 import 'test_helper.dart'; |
| 10 import 'service_test_common.dart'; |
| 11 |
| 12 const LINE_A = 37; |
| 13 |
| 14 class Foo { |
| 15 |
| 16 } |
| 17 |
| 18 doThrow() { |
| 19 throw "TheException"; // Line 13. |
| 20 return "end of doThrow"; |
| 21 } |
| 22 |
| 23 asyncThrower() async { |
| 24 doThrow(); |
| 25 } |
| 26 |
| 27 testeeMain() async { |
| 28 try { |
| 29 // caught. |
| 30 try { |
| 31 await asyncThrower(); |
| 32 } catch (e) { |
| 33 } |
| 34 |
| 35 // uncaught. |
| 36 try { |
| 37 await asyncThrower(); // LINE_A. |
| 38 } on double catch (e) { |
| 39 } |
| 40 } on Foo catch (e) { |
| 41 } |
| 42 } |
| 43 |
| 44 var tests = [ |
| 45 hasStoppedWithUnhandledException, |
| 46 |
| 47 (Isolate isolate) async { |
| 48 print("We stoppped!"); |
| 49 var stack = await isolate.getStack(); |
| 50 expect(stack['asyncCausalFrames'], isNotNull); |
| 51 var asyncStack = stack['asyncCausalFrames']; |
| 52 expect(asyncStack[0].toString(), contains('doThrow')); |
| 53 expect(asyncStack[1].toString(), contains('asyncThrower')); |
| 54 expect(asyncStack[2].kind, equals(M.FrameKind.asyncSuspensionMarker)); |
| 55 expect(asyncStack[3].toString(), contains('testeeMain')); |
| 56 // We've stopped at LINE_A. |
| 57 expect(await asyncStack[3].location.toUserString(), |
| 58 contains('.dart:$LINE_A')); |
| 59 } |
| 60 ]; |
| 61 |
| 62 main(args) => runIsolateTests(args, |
| 63 tests, |
| 64 pause_on_unhandled_exceptions: true, |
| 65 testeeConcurrent: testeeMain); |
OLD | NEW |