| 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=--error_on_bad_type --error_on_bad_override --verbose_debug |
| 5 |
| 6 import 'package:observatory/service_io.dart'; |
| 7 import 'test_helper.dart'; |
| 8 import 'dart:developer'; |
| 9 import 'package:unittest/unittest.dart'; |
| 10 |
| 11 foo(param) { |
| 12 return param; |
| 13 } |
| 14 |
| 15 fooClosure() { |
| 16 theClosureFunction(param) { |
| 17 return param; |
| 18 } |
| 19 return theClosureFunction; |
| 20 } |
| 21 |
| 22 testMain() { |
| 23 debugger(); |
| 24 foo("in-scope"); // Line 24 |
| 25 |
| 26 var f = fooClosure(); |
| 27 debugger(); |
| 28 f("in-scope"); // Line 28 |
| 29 } |
| 30 |
| 31 var tests = [ |
| 32 hasStoppedAtBreakpoint, |
| 33 stoppedAtLine(24), |
| 34 (isolate) => isolate.stepInto(), |
| 35 hasStoppedAtBreakpoint, |
| 36 (isolate) async { |
| 37 var stack = await isolate.getStack(); |
| 38 Frame top = stack['frames'][0]; |
| 39 print(top); |
| 40 expect(top.function.name, equals("foo")); |
| 41 print(top.variables); |
| 42 expect(top.variables.length, equals(1)); |
| 43 var param = top.variables[0]; |
| 44 expect(param['name'], equals("param")); |
| 45 expect(param['value'].valueAsString, equals("in-scope")); |
| 46 }, |
| 47 resumeIsolate, |
| 48 |
| 49 hasStoppedAtBreakpoint, |
| 50 stoppedAtLine(28), |
| 51 (isolate) => isolate.stepInto(), |
| 52 hasStoppedAtBreakpoint, |
| 53 (isolate) async { |
| 54 var stack = await isolate.getStack(); |
| 55 Frame top = stack['frames'][0]; |
| 56 print(top); |
| 57 expect(top.function.name, equals("theClosureFunction")); |
| 58 print(top.variables); |
| 59 expect(top.variables.length, equals(1)); |
| 60 var param = top.variables[0]; |
| 61 expect(param['name'], equals("param")); |
| 62 expect(param['value'].valueAsString, equals("in-scope")); |
| 63 }, |
| 64 resumeIsolate, |
| 65 ]; |
| 66 |
| 67 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |