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