| 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 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug | 4 // VMOptions=--error_on_bad_type --error_on_bad_override --verbose_debug |
| 5 | 5 |
| 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 import 'dart:developer'; | 10 import 'dart:developer'; |
| 11 | 11 |
| 12 testParameters(int jjjj, int oooo, [int hhhh, int nnnn]) { | 12 testParameters(int jjjj, int oooo, [int hhhh, int nnnn]) { |
| 13 debugger(); | 13 debugger(); |
| 14 } | 14 } |
| 15 | 15 |
| 16 testMain() { | 16 testMain() { |
| 17 int xxx, yyyy, zzzzz; | 17 int xxx, yyyy, zzzzz; |
| 18 for (int i = 0; i < 1; i++) { | 18 for (int i = 0; i < 1; i++) { |
| 19 var foo = () { | 19 var foo = () {}; |
| 20 }; | |
| 21 debugger(); | 20 debugger(); |
| 22 } | 21 } |
| 23 var bar = () { | 22 var bar = () { |
| 24 print(xxx); | 23 print(xxx); |
| 25 print(yyyy); | 24 print(yyyy); |
| 26 debugger(); | 25 debugger(); |
| 27 }; | 26 }; |
| 28 bar(); | 27 bar(); |
| 29 testParameters(0, 0); | 28 testParameters(0, 0); |
| 30 } | 29 } |
| (...skipping 17 matching lines...) Expand all Loading... |
| 48 final int declarationTokenPos = variable['declarationTokenPos']; | 47 final int declarationTokenPos = variable['declarationTokenPos']; |
| 49 final String name = variable['name']; | 48 final String name = variable['name']; |
| 50 final String token = script.getToken(declarationTokenPos); | 49 final String token = script.getToken(declarationTokenPos); |
| 51 expect(name, token); | 50 expect(name, token); |
| 52 } | 51 } |
| 53 }, | 52 }, |
| 54 resumeIsolate, | 53 resumeIsolate, |
| 55 hasStoppedAtBreakpoint, | 54 hasStoppedAtBreakpoint, |
| 56 // We have stopped in the anonymous closure assigned to bar. Verify that | 55 // We have stopped in the anonymous closure assigned to bar. Verify that |
| 57 // variables captured in the context have valid declaration positions. | 56 // variables captured in the context have valid declaration positions. |
| 58 (Isolate isolate) async { | 57 (Isolate isolate) async { |
| 59 var stack = await isolate.getStack(); | 58 var stack = await isolate.getStack(); |
| 60 expect(stack.type, equals('Stack')); | 59 expect(stack.type, equals('Stack')); |
| 61 expect(stack['frames'].length, greaterThanOrEqualTo(1)); | 60 expect(stack['frames'].length, greaterThanOrEqualTo(1)); |
| 62 // Grab the top frame. | 61 // Grab the top frame. |
| 63 Frame frame = stack['frames'][0]; | 62 Frame frame = stack['frames'][0]; |
| 64 // Grab the script. | 63 // Grab the script. |
| 65 Script script = frame.location.script; | 64 Script script = frame.location.script; |
| 66 await script.load(); | 65 await script.load(); |
| 67 print(frame); | 66 print(frame); |
| 68 expect(frame.variables.length, greaterThanOrEqualTo(1)); | 67 expect(frame.variables.length, greaterThanOrEqualTo(1)); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 92 for (var variable in frame.variables) { | 91 for (var variable in frame.variables) { |
| 93 final int declarationTokenPos = variable['declarationTokenPos']; | 92 final int declarationTokenPos = variable['declarationTokenPos']; |
| 94 final String name = variable['name']; | 93 final String name = variable['name']; |
| 95 final String token = script.getToken(declarationTokenPos); | 94 final String token = script.getToken(declarationTokenPos); |
| 96 expect(name, token); | 95 expect(name, token); |
| 97 } | 96 } |
| 98 } | 97 } |
| 99 ]; | 98 ]; |
| 100 | 99 |
| 101 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 100 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
| OLD | NEW |