OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2017, 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 |
| 5 import 'test_helper.dart'; |
| 6 import 'service_test_common.dart'; |
| 7 |
| 8 const int LINE = 12; |
| 9 const String file = "step_through_constructor_calls_test.dart"; |
| 10 |
| 11 code() { |
| 12 Foo foo1 = new Foo(); |
| 13 print(foo1.x); |
| 14 Foo foo2 = new Foo.named(); |
| 15 print(foo2.x); |
| 16 Foo foo3 = const Foo(); |
| 17 print(foo3.x); |
| 18 Foo foo4 = const Foo.named(); |
| 19 print(foo4.x); |
| 20 Foo foo5 = new Foo.named2(1, 2, 3); |
| 21 print(foo5.x); |
| 22 } |
| 23 |
| 24 class Foo { |
| 25 final int x; |
| 26 |
| 27 const Foo() : x = 1; |
| 28 |
| 29 const Foo.named() : x = 2; |
| 30 |
| 31 const Foo.named2(int aaaaaaaa, int bbbbbbbbbb, int ccccccccccccc) |
| 32 : x = aaaaaaaa + bbbbbbbbbb + ccccccccccccc; |
| 33 } |
| 34 |
| 35 List<String> stops = []; |
| 36 List<String> expected = [ |
| 37 "$file:${LINE+0}:18", // on 'Foo' |
| 38 "$file:${LINE+15}:12", // on '(' in 'const Foo() : x = 1;' |
| 39 "$file:${LINE+15}:22", // on ';' in same line |
| 40 "$file:${LINE+1}:14", // on 'x' |
| 41 "$file:${LINE+1}:3", // on print |
| 42 "$file:${LINE+2}:18", // on 'Foo' |
| 43 "$file:${LINE+17}:18", // on '(' in 'const Foo.named() : x = 2;' |
| 44 "$file:${LINE+17}:28", // on ';' in same line |
| 45 "$file:${LINE+3}:14", // on 'x' |
| 46 "$file:${LINE+3}:3", // on print |
| 47 "$file:${LINE+4}:12", // on '=' |
| 48 "$file:${LINE+5}:14", // on 'x' |
| 49 "$file:${LINE+5}:3", // on print |
| 50 "$file:${LINE+6}:12", // on '=' |
| 51 "$file:${LINE+7}:14", // on 'x' |
| 52 "$file:${LINE+7}:3", // on print |
| 53 "$file:${LINE+8}:18", // on 'Foo' |
| 54 "$file:${LINE+19}:54", // on 'ccccccccccccc' |
| 55 "$file:${LINE+20}:22", // on first '+' |
| 56 "$file:${LINE+20}:35", // on second '+' |
| 57 "$file:${LINE+20}:50", // on ';' |
| 58 "$file:${LINE+9}:14", // on 'x' |
| 59 "$file:${LINE+9}:3", // on print |
| 60 "$file:${LINE+10}:1" // on ending '}' |
| 61 ]; |
| 62 |
| 63 var tests = [ |
| 64 hasPausedAtStart, |
| 65 setBreakpointAtLine(LINE), |
| 66 runStepIntoThroughProgramRecordingStops(stops), |
| 67 // removeDuplicates: Source-based debugging stops on the ';' |
| 68 // in the constructors twice. Kernel does not. For now we'll accept that. |
| 69 checkRecordedStops(stops, expected, removeDuplicates: true) |
| 70 ]; |
| 71 |
| 72 main(args) { |
| 73 runIsolateTestsSynchronous(args, tests, |
| 74 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
| 75 } |
OLD | NEW |