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