| 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:developer'; | 6 import 'dart:developer'; |
| 7 import 'dart:io'; | 7 import 'package:observatory/models.dart' as M; |
| 8 | 8 import 'package:observatory/service_io.dart'; |
| 9 import 'package:unittest/unittest.dart'; |
| 9 import 'service_test_common.dart'; | 10 import 'service_test_common.dart'; |
| 10 import 'test_helper.dart'; | 11 import 'test_helper.dart'; |
| 11 | 12 |
| 13 const LINE_A = 24; |
| 14 const LINE_B = 25; |
| 15 const LINE_C = 29; |
| 16 const LINE_D = 32; |
| 17 const LINE_E = 39; |
| 18 const LINE_F = 40; |
| 19 const LINE_G = 41; |
| 20 const LINE_H = 30; |
| 21 const LINE_I = 34; |
| 22 |
| 12 foobar() async* { | 23 foobar() async* { |
| 13 yield 1; // LINE_A. | 24 yield 1; // LINE_A. |
| 14 yield 2; // LINE_B. | 25 yield 2; // LINE_B. |
| 15 } | 26 } |
| 16 | 27 |
| 17 helper() async { | 28 helper() async { |
| 18 print('helper'); // LINE_C. | 29 print('helper'); // LINE_C. |
| 19 await for (var i in foobar()) /* LINE_H */ { | 30 await for (var i in foobar()) { // LINE_H. |
| 20 debugger(); | 31 debugger(); |
| 21 print('loop'); // LINE_D. | 32 print('loop'); // LINE_D. |
| 22 } | 33 } |
| 23 return null; // LINE_I. | 34 return null; // LINE_I. |
| 24 } | 35 } |
| 25 | 36 |
| 26 testMain() { | 37 testMain() { |
| 27 debugger(); | 38 debugger(); |
| 28 print('mmmmm'); // LINE_E. | 39 print('mmmmm'); // LINE_E. |
| 29 helper(); // LINE_F. | 40 helper(); // LINE_F. |
| 30 print('z'); // LINE_G. | 41 print('z'); // LINE_G. |
| 31 } | 42 } |
| 32 | 43 |
| 33 final ScriptLineParser lineParser = new ScriptLineParser(Platform.script); | |
| 34 | |
| 35 var tests = [ | 44 var tests = [ |
| 36 hasStoppedAtBreakpoint, | 45 hasStoppedAtBreakpoint, |
| 37 stoppedAtLine(lineParser.lineFor('LINE_E')), | 46 stoppedAtLine(LINE_E), |
| 38 stepOver, // print. | 47 stepOver, // print. |
| 39 hasStoppedAtBreakpoint, | 48 hasStoppedAtBreakpoint, |
| 40 stoppedAtLine(lineParser.lineFor('LINE_F')), | 49 stoppedAtLine(LINE_F), |
| 41 stepInto, | 50 stepInto, |
| 42 hasStoppedAtBreakpoint, | 51 hasStoppedAtBreakpoint, |
| 43 stoppedAtLine(lineParser.lineFor('LINE_C')), | 52 stoppedAtLine(LINE_C), |
| 44 stepOver, // print. | 53 stepOver, // print. |
| 45 hasStoppedAtBreakpoint, | 54 hasStoppedAtBreakpoint, |
| 46 stepInto, | 55 stepInto, |
| 47 hasStoppedAtBreakpoint, | 56 hasStoppedAtBreakpoint, |
| 48 stoppedAtLine(lineParser.lineFor('LINE_A')), | 57 stoppedAtLine(LINE_A), |
| 49 stepOut, // step out of generator. | 58 stepOut, // step out of generator. |
| 50 hasStoppedAtBreakpoint, | 59 hasStoppedAtBreakpoint, |
| 51 stoppedAtLine(lineParser.lineFor('LINE_H')), // await for. | 60 stoppedAtLine(LINE_H), // await for. |
| 52 stepInto, | 61 stepInto, |
| 53 hasStoppedAtBreakpoint, // debugger(). | 62 hasStoppedAtBreakpoint, // debugger(). |
| 54 stepInto, | 63 stepInto, |
| 55 hasStoppedAtBreakpoint, | 64 hasStoppedAtBreakpoint, |
| 56 stoppedAtLine(lineParser.lineFor('LINE_D')), // print. | 65 stoppedAtLine(LINE_D), // print. |
| 57 stepInto, | 66 stepInto, |
| 58 hasStoppedAtBreakpoint, // await for. | 67 hasStoppedAtBreakpoint, // await for. |
| 59 stepInto, | 68 stepInto, |
| 60 hasStoppedAtBreakpoint, // back in generator. | 69 hasStoppedAtBreakpoint, // back in generator. |
| 61 stoppedAtLine(lineParser.lineFor('LINE_B')), | 70 stoppedAtLine(LINE_B), |
| 62 stepOut, // step out of generator. | 71 stepOut, // step out of generator. |
| 63 hasStoppedAtBreakpoint, | 72 hasStoppedAtBreakpoint, |
| 64 stoppedAtLine(lineParser.lineFor('LINE_H')), // await for. | 73 stoppedAtLine(LINE_H), // await for. |
| 65 stepInto, | 74 stepInto, |
| 66 hasStoppedAtBreakpoint, // debugger(). | 75 hasStoppedAtBreakpoint, // debugger(). |
| 67 stepInto, | 76 stepInto, |
| 68 hasStoppedAtBreakpoint, | 77 hasStoppedAtBreakpoint, |
| 69 stoppedAtLine(lineParser.lineFor('LINE_D')), // print. | 78 stoppedAtLine(LINE_D), // print. |
| 70 stepInto, | 79 stepInto, |
| 71 hasStoppedAtBreakpoint, | 80 hasStoppedAtBreakpoint, |
| 72 stoppedAtLine(lineParser.lineFor('LINE_H')), // await for. | 81 stoppedAtLine(LINE_H), // await for. |
| 73 stepInto, | 82 stepInto, |
| 74 hasStoppedAtBreakpoint, | 83 hasStoppedAtBreakpoint, |
| 75 stepOut, // step out of generator. | 84 stepOut, // step out of generator. |
| 76 hasStoppedAtBreakpoint, | 85 hasStoppedAtBreakpoint, |
| 77 stoppedAtLine(lineParser.lineFor('LINE_I')), // return null. | 86 stoppedAtLine(LINE_I), // return null. |
| 78 ]; | 87 ]; |
| 79 | 88 |
| 80 main(args) => | 89 main(args) => |
| 81 runIsolateTestsSynchronous(args, tests, testeeConcurrent: testMain); | 90 runIsolateTestsSynchronous(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |