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