| 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 'package:observatory/models.dart' as M; | 7 import 'dart:io'; |
| 8 import 'package:observatory/service_io.dart'; | 8 |
| 9 import 'package:unittest/unittest.dart'; | |
| 10 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
| 11 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
| 12 | 11 |
| 13 const LINE_A = 21; | |
| 14 const LINE_B = 22; | |
| 15 const LINE_C = 26; | |
| 16 const LINE_D = 29; | |
| 17 const LINE_E = 35; | |
| 18 const LINE_F = 36; | |
| 19 | |
| 20 foobar() async* { | 12 foobar() async* { |
| 21 yield 1; // LINE_A. | 13 yield 1; // LINE_A. |
| 22 yield 2; // LINE_B. | 14 yield 2; // LINE_B. |
| 23 } | 15 } |
| 24 | 16 |
| 25 helper() async { | 17 helper() async { |
| 26 print('helper'); // LINE_C. | 18 print('helper'); // LINE_C. |
| 27 await for (var i in foobar()) { | 19 await for (var i in foobar()) { |
| 28 debugger(); | 20 debugger(); |
| 29 print('loop'); // LINE_D. | 21 print('loop'); // LINE_D. |
| 30 } | 22 } |
| 31 } | 23 } |
| 32 | 24 |
| 33 testMain() { | 25 testMain() { |
| 34 debugger(); | 26 debugger(); |
| 35 print('mmmmm'); // LINE_E. | 27 print('mmmmm'); // LINE_E. |
| 36 helper(); // LINE_F. | 28 helper(); // LINE_F. |
| 37 print('z'); | 29 print('z'); |
| 38 } | 30 } |
| 39 | 31 |
| 32 final ScriptLineParser lineParser = new ScriptLineParser(Platform.script); |
| 33 |
| 40 var tests = [ | 34 var tests = [ |
| 41 hasStoppedAtBreakpoint, | 35 hasStoppedAtBreakpoint, |
| 42 stoppedAtLine(LINE_E), | 36 stoppedAtLine(lineParser.lineFor('LINE_E')), |
| 43 stepOver, // print. | 37 stepOver, // print. |
| 44 hasStoppedAtBreakpoint, | 38 hasStoppedAtBreakpoint, |
| 45 stoppedAtLine(LINE_F), | 39 stoppedAtLine(lineParser.lineFor('LINE_F')), |
| 46 stepInto, | 40 stepInto, |
| 47 hasStoppedAtBreakpoint, | 41 hasStoppedAtBreakpoint, |
| 48 stoppedAtLine(LINE_C), | 42 stoppedAtLine(lineParser.lineFor('LINE_C')), |
| 49 stepOver, // print. | 43 stepOver, // print. |
| 50 hasStoppedAtBreakpoint, | 44 hasStoppedAtBreakpoint, |
| 51 stepInto, | 45 stepInto, |
| 52 hasStoppedAtBreakpoint, | 46 hasStoppedAtBreakpoint, |
| 53 stoppedAtLine(LINE_A), | 47 stoppedAtLine(lineParser.lineFor('LINE_A')), |
| 54 // Resume here to exit the generator function. | 48 // Resume here to exit the generator function. |
| 55 // TODO(johnmccutchan): Implement support for step-out of async functions. | 49 // TODO(johnmccutchan): Implement support for step-out of async functions. |
| 56 resumeIsolate, | 50 resumeIsolate, |
| 57 hasStoppedAtBreakpoint, | 51 hasStoppedAtBreakpoint, |
| 58 stoppedAtLine(LINE_D), | 52 stoppedAtLine(lineParser.lineFor('LINE_D')), |
| 59 stepOver, // print. | 53 stepOver, // print. |
| 60 hasStoppedAtBreakpoint, | 54 hasStoppedAtBreakpoint, |
| 61 stepInto, | 55 stepInto, |
| 62 hasStoppedAtBreakpoint, | 56 hasStoppedAtBreakpoint, |
| 63 stoppedAtLine(LINE_B), | 57 stoppedAtLine(lineParser.lineFor('LINE_B')), |
| 64 resumeIsolate, | 58 resumeIsolate, |
| 65 ]; | 59 ]; |
| 66 | 60 |
| 67 main(args) => | 61 main(args) => |
| 68 runIsolateTestsSynchronous(args, tests, testeeConcurrent: testMain); | 62 runIsolateTestsSynchronous(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |