OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 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 | 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=--compile-all --error_on_bad_type --error_on_bad_override | 4 // VMOptions=--compile-all --error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import "package:expect/expect.dart"; | |
7 import 'package:observatory/service_io.dart'; | 6 import 'package:observatory/service_io.dart'; |
8 import 'package:unittest/unittest.dart'; | 7 import 'package:unittest/unittest.dart'; |
9 import 'test_helper.dart'; | 8 import 'test_helper.dart'; |
10 import 'dart:async'; | 9 import 'dart:async'; |
11 import 'dart:developer'; | 10 import 'dart:developer'; |
12 | 11 |
13 testFunction() { | 12 testFunction() { |
14 debugger(); | 13 debugger(); |
15 var a; | 14 var a; |
16 try { | 15 try { |
17 var b; | 16 var b; |
18 try { | 17 try { |
19 for (int i = 0; i < 10; i++) { | 18 for (int i = 0; i < 10; i++) { |
20 var x = () => i + a + b; | 19 var x = () => i + a + b; |
21 return x; // line 20 | 20 return x; // line 20 |
22 } | 21 } |
23 } finally { | 22 } finally { |
24 b = 10; // line 23 | 23 b = 10; // line 23 |
25 } | 24 } |
26 } finally { | 25 } finally { |
27 a = 1; // line 26 | 26 a = 1; // line 26 |
28 } | 27 } |
29 } | 28 } |
30 | 29 |
31 testMain() { | 30 testMain() { |
32 var f = testFunction(); | 31 var f = testFunction(); |
33 Expect.equals(11, f()); | 32 expect(f(), equals(11)); |
34 | |
35 } | 33 } |
36 | 34 |
37 var tests = [ | 35 var tests = [ |
38 | 36 |
39 hasStoppedAtBreakpoint, | 37 hasStoppedAtBreakpoint, |
40 | 38 |
41 // Add breakpoint | 39 // Add breakpoint |
42 (Isolate isolate) async { | 40 (Isolate isolate) async { |
43 await isolate.rootLibrary.load(); | 41 await isolate.rootLibrary.load(); |
44 | 42 |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 117 |
120 Script script = stack['frames'][0].location.script; | 118 Script script = stack['frames'][0].location.script; |
121 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(26)); | 119 expect(script.tokenToLine(stack['frames'][0].location.tokenPos), equals(26)); |
122 }, | 120 }, |
123 | 121 |
124 resumeIsolate, | 122 resumeIsolate, |
125 | 123 |
126 ]; | 124 ]; |
127 | 125 |
128 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); | 126 main(args) => runIsolateTests(args, tests, testeeConcurrent: testMain); |
OLD | NEW |