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 'dart:developer'; | 6 import 'dart:developer'; |
7 import 'package:observatory/service_io.dart'; | 7 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:unittest/unittest.dart'; |
9 import 'service_test_common.dart'; | 9 import 'service_test_common.dart'; |
10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
11 | 11 |
12 helper() async { // Line 12, Col 16 is the open brace. | 12 helper() async { |
| 13 // Line 12, Col 16 is the open brace. |
13 } | 14 } |
14 | 15 |
15 testMain() { | 16 testMain() { |
16 debugger(); | 17 debugger(); |
17 helper(); // Line 17, Col 3 is the position of the function call. | 18 helper(); // Line 17, Col 3 is the position of the function call. |
18 } | 19 } |
19 | 20 |
20 var tests = [ | 21 var tests = [ |
21 hasStoppedAtBreakpoint, | 22 hasStoppedAtBreakpoint, |
22 markDartColonLibrariesDebuggable, | 23 markDartColonLibrariesDebuggable, |
23 stoppedAtLine(17), | 24 stoppedAtLine(17), |
24 stepInto, | 25 stepInto, |
25 | |
26 (Isolate isolate) async { | 26 (Isolate isolate) async { |
27 ServiceMap stack = await isolate.getStack(); | 27 ServiceMap stack = await isolate.getStack(); |
28 expect(stack['frames'].length, greaterThan(3)); | 28 expect(stack['frames'].length, greaterThan(3)); |
29 | 29 |
30 var frame = stack['frames'][0]; | 30 var frame = stack['frames'][0]; |
31 expect(frame.function.name, equals('Completer.sync')); | 31 expect(frame.function.name, equals('Completer.sync')); |
32 expect(await frame.location.getLine(), greaterThan(0)); | 32 expect(await frame.location.getLine(), greaterThan(0)); |
33 expect(await frame.location.getColumn(), greaterThan(0)); | 33 expect(await frame.location.getColumn(), greaterThan(0)); |
34 | 34 |
35 // We used to return a negative token position for this frame. | 35 // We used to return a negative token position for this frame. |
36 // See issue #27128. | 36 // See issue #27128. |
37 frame = stack['frames'][1]; | 37 frame = stack['frames'][1]; |
38 expect(frame.function.name, equals('helper')); | 38 expect(frame.function.name, equals('helper')); |
39 expect(await frame.location.getLine(), equals(12)); | 39 expect(await frame.location.getLine(), equals(12)); |
40 expect(await frame.location.getColumn(), equals(16)); | 40 expect(await frame.location.getColumn(), equals(16)); |
41 | 41 |
42 frame = stack['frames'][2]; | 42 frame = stack['frames'][2]; |
43 expect(frame.function.name, equals('testMain')); | 43 expect(frame.function.name, equals('testMain')); |
44 expect(await frame.location.getLine(), equals(17)); | 44 expect(await frame.location.getLine(), equals(17)); |
45 expect(await frame.location.getColumn(), equals(3)); | 45 expect(await frame.location.getColumn(), equals(3)); |
46 } | 46 } |
47 ]; | 47 ]; |
48 | 48 |
49 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 49 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |