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