OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015, 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 // VMOptions=--compile_all --error_on_bad_type --error_on_bad_override --verbos
e_debug |
| 5 |
| 6 import 'package:observatory/service_io.dart'; |
| 7 import 'package:unittest/unittest.dart'; |
| 8 import 'test_helper.dart'; |
| 9 import 'dart:developer'; |
| 10 |
| 11 testFunction(flag) { // Line 11 |
| 12 if (flag) { |
| 13 print("Yes"); |
| 14 } else { |
| 15 print("No"); |
| 16 } |
| 17 } |
| 18 |
| 19 testMain() { |
| 20 debugger(); |
| 21 testFunction(true); |
| 22 testFunction(false); |
| 23 print("Done"); |
| 24 } |
| 25 |
| 26 var tests = [ |
| 27 |
| 28 hasStoppedAtBreakpoint, |
| 29 |
| 30 // Add breakpoint |
| 31 (Isolate isolate) async { |
| 32 var rootLib = await isolate.rootLibrary.load(); |
| 33 var function = rootLib.functions.singleWhere((f) => f.name == 'testFunction'); |
| 34 |
| 35 var bpt = await isolate.addBreakpointAtEntry(function); |
| 36 expect(bpt is Breakpoint, isTrue); |
| 37 print(bpt); |
| 38 }, |
| 39 |
| 40 resumeIsolate, |
| 41 |
| 42 hasStoppedAtBreakpoint, |
| 43 |
| 44 // We are at the breakpoint on line 11. |
| 45 (Isolate isolate) async { |
| 46 ServiceMap stack = await isolate.getStack(); |
| 47 expect(stack.type, equals('Stack')); |
| 48 expect(stack['frames'].length, greaterThanOrEqualTo(1)); |
| 49 |
| 50 Script script = stack['frames'][0].location.script; |
| 51 expect(stack['frames'][0].location.tokenPos, equals(22)); |
| 52 }, |
| 53 |
| 54 resumeIsolate, |
| 55 |
| 56 hasStoppedAtBreakpoint, |
| 57 |
| 58 // We are at the breakpoint on line 11. |
| 59 (Isolate isolate) async { |
| 60 ServiceMap stack = await isolate.getStack(); |
| 61 expect(stack.type, equals('Stack')); |
| 62 expect(stack['frames'].length, greaterThanOrEqualTo(1)); |
| 63 |
| 64 Script script = stack['frames'][0].location.script; |
| 65 expect(stack['frames'][0].location.tokenPos, equals(22)); |
| 66 }, |
| 67 |
| 68 resumeIsolate, |
| 69 |
| 70 ]; |
| 71 |
| 72 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |