| OLD | NEW |
| 1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 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 | 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 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug --asyn
c_debugger | 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug --asyn
c_debugger |
| 5 | 5 |
| 6 import 'dart:async'; | |
| 7 import 'dart:developer'; | 6 import 'dart:developer'; |
| 8 import 'package:observatory/models.dart' as M; | 7 import 'dart:io'; |
| 9 import 'package:observatory/service_io.dart'; | 8 |
| 10 import 'package:unittest/unittest.dart'; | |
| 11 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
| 12 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
| 13 | 11 |
| 14 const LINE_A = 23; | |
| 15 const LINE_B = 24; | |
| 16 const LINE_C = 30; | |
| 17 const LINE_D = 32; | |
| 18 const LINE_E = 35; | |
| 19 const LINE_F = 38; | |
| 20 const LINE_G = 40; | |
| 21 | |
| 22 helper() async { | 12 helper() async { |
| 23 print('helper'); // LINE_A. | 13 print('helper'); // LINE_A. |
| 24 throw 'a'; // LINE_B. | 14 throw 'a'; // LINE_B. |
| 25 return null; | 15 return null; |
| 26 } | 16 } |
| 27 | 17 |
| 28 testMain() async { | 18 testMain() async { |
| 29 debugger(); | 19 debugger(); |
| 30 print('mmmmm'); // LINE_C. | 20 print('mmmmm'); // LINE_C. |
| 31 try { | 21 try { |
| 32 await helper(); // LINE_D. | 22 await helper(); // LINE_D. |
| 33 } catch (e) { | 23 } catch (e) { |
| 34 // arrive here on error. | 24 // arrive here on error. |
| 35 print('error: $e'); // LINE_E. | 25 print('error: $e'); // LINE_E. |
| 36 } finally { | 26 } finally { |
| 37 // arrive here in both cases. | 27 // arrive here in both cases. |
| 38 print('foo'); // LINE_F. | 28 print('foo'); // LINE_F. |
| 39 } | 29 } |
| 40 print('z'); // LINE_G. | 30 print('z'); // LINE_G. |
| 41 } | 31 } |
| 42 | 32 |
| 33 final ScriptLineParser lineParser = new ScriptLineParser(Platform.script); |
| 34 |
| 43 var tests = [ | 35 var tests = [ |
| 44 hasStoppedAtBreakpoint, | 36 hasStoppedAtBreakpoint, |
| 45 stoppedAtLine(LINE_C), | 37 stoppedAtLine(lineParser.lineFor('LINE_C')), |
| 46 stepOver, // print. | 38 stepOver, // print. |
| 47 hasStoppedAtBreakpoint, | 39 hasStoppedAtBreakpoint, |
| 48 stoppedAtLine(LINE_D), | 40 stoppedAtLine(lineParser.lineFor('LINE_D')), |
| 49 stepInto, | 41 stepInto, |
| 50 hasStoppedAtBreakpoint, | 42 hasStoppedAtBreakpoint, |
| 51 stoppedAtLine(LINE_A), | 43 stoppedAtLine(lineParser.lineFor('LINE_A')), |
| 52 stepOver, // print. | 44 stepOver, // print. |
| 53 hasStoppedAtBreakpoint, | 45 hasStoppedAtBreakpoint, |
| 54 stoppedAtLine(LINE_B), // throw 'a'. | 46 stoppedAtLine(lineParser.lineFor('LINE_B')), // throw 'a'. |
| 55 stepInto, // exit helper via a throw. | 47 stepInto, // exit helper via a throw. |
| 56 hasStoppedAtBreakpoint, | 48 hasStoppedAtBreakpoint, |
| 57 stepInto, // exit helper via a throw. | 49 stepInto, // exit helper via a throw. |
| 58 hasStoppedAtBreakpoint, | 50 hasStoppedAtBreakpoint, |
| 59 stepInto, // step once from entry to main. | 51 stepInto, // step once from entry to main. |
| 60 hasStoppedAtBreakpoint, | 52 hasStoppedAtBreakpoint, |
| 61 stoppedAtLine(LINE_E), // print(error) | 53 stoppedAtLine(lineParser.lineFor('LINE_E')), // print(error) |
| 62 stepOver, | 54 stepOver, |
| 63 hasStoppedAtBreakpoint, | 55 hasStoppedAtBreakpoint, |
| 64 stepOver, | 56 stepOver, |
| 65 hasStoppedAtBreakpoint, | 57 hasStoppedAtBreakpoint, |
| 66 stoppedAtLine(LINE_F), // print(foo) | 58 stoppedAtLine(lineParser.lineFor('LINE_F')), // print(foo) |
| 67 stepOver, | 59 stepOver, |
| 68 hasStoppedAtBreakpoint, | 60 hasStoppedAtBreakpoint, |
| 69 stoppedAtLine(LINE_G), // print(z) | 61 stoppedAtLine(lineParser.lineFor('LINE_G')), // print(z) |
| 70 resumeIsolate | 62 resumeIsolate |
| 71 ]; | 63 ]; |
| 72 | 64 |
| 73 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 65 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |