OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 | 4 |
5 import 'dart:developer'; | 5 import 'dart:developer'; |
6 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
7 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
8 import 'service_test_common.dart'; | 8 import 'service_test_common.dart'; |
9 import 'test_helper.dart'; | 9 import 'test_helper.dart'; |
10 | 10 |
11 generator() async* { | 11 generator() async* { |
12 var x = 3; | 12 var x = 3; |
13 var y = 4; | 13 var y = 4; |
14 debugger(); | 14 debugger(); |
15 yield y; | 15 yield y; |
16 var z = x + y; | 16 var z = x + y; |
17 debugger(); | 17 debugger(); |
18 yield z; | 18 yield z; |
19 } | 19 } |
20 | 20 |
21 testFunction() async { | 21 testFunction() async { |
22 await for (var ignored in generator()); | 22 await for (var ignored in generator()); |
23 } | 23 } |
24 | 24 |
25 var tests = [ | 25 var tests = [ |
| 26 hasStoppedAtBreakpoint, |
| 27 (Isolate isolate) async { |
| 28 // Make sure we are in the right place. |
| 29 var stack = await isolate.getStack(); |
| 30 var topFrame = 0; |
| 31 expect(stack.type, equals('Stack')); |
| 32 expect(await stack['frames'][topFrame].location.getLine(), 15); |
26 | 33 |
27 hasStoppedAtBreakpoint, | 34 var result = await isolate.evalFrame(topFrame, "x"); |
| 35 print(result); |
| 36 expect(result.valueAsString, equals("3")); |
| 37 }, |
| 38 resumeIsolate, |
| 39 hasStoppedAtBreakpoint, |
| 40 (Isolate isolate) async { |
| 41 // Make sure we are in the right place. |
| 42 var stack = await isolate.getStack(); |
| 43 var topFrame = 0; |
| 44 expect(stack.type, equals('Stack')); |
| 45 expect(await stack['frames'][topFrame].location.getLine(), 18); |
28 | 46 |
29 (Isolate isolate) async { | 47 var result = await isolate.evalFrame(topFrame, "z"); |
30 // Make sure we are in the right place. | 48 print(result); |
31 var stack = await isolate.getStack(); | 49 expect(result.valueAsString, equals("7")); |
32 var topFrame = 0; | 50 }, |
33 expect(stack.type, equals('Stack')); | 51 resumeIsolate, |
34 expect(await stack['frames'][topFrame].location.getLine(), 15); | |
35 | |
36 var result = await isolate.evalFrame(topFrame, "x"); | |
37 print(result); | |
38 expect(result.valueAsString, equals("3")); | |
39 }, | |
40 | |
41 resumeIsolate, | |
42 | |
43 hasStoppedAtBreakpoint, | |
44 | |
45 (Isolate isolate) async { | |
46 // Make sure we are in the right place. | |
47 var stack = await isolate.getStack(); | |
48 var topFrame = 0; | |
49 expect(stack.type, equals('Stack')); | |
50 expect(await stack['frames'][topFrame].location.getLine(), 18); | |
51 | |
52 var result = await isolate.evalFrame(topFrame, "z"); | |
53 print(result); | |
54 expect(result.valueAsString, equals("7")); | |
55 }, | |
56 | |
57 resumeIsolate, | |
58 | |
59 ]; | 52 ]; |
60 | 53 |
61 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); | 54 main(args) => runIsolateTests(args, tests, testeeConcurrent: testFunction); |
OLD | NEW |