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 = 11; |
| 9 const String file = "step_through_function_test.dart"; |
| 10 |
| 11 code() { |
| 12 Bar bar = new Bar(); |
| 13 print(bar.barXYZ1()); |
| 14 print(bar.barXYZ2(4, 2)); |
| 15 print(bar.barXYZ3()); |
| 16 print(bar.barXYZ4(4, 2)); |
| 17 print(fooXYZ1()); |
| 18 print(fooXYZ2(4, 2)); |
| 19 print(fooXYZ3()); |
| 20 print(fooXYZ4(4, 2)); |
| 21 } |
| 22 |
| 23 fooXYZ1 /**/ () => "fooXYZ"; |
| 24 fooXYZ2 /**/ (int i, int j) => "fooXYZ${i}${j}"; |
| 25 fooXYZ3 /**/ () { |
| 26 return "fooXYZ"; |
| 27 } |
| 28 |
| 29 fooXYZ4 /**/ (int i, int j) { |
| 30 return "fooXYZ${i}${j}"; |
| 31 } |
| 32 |
| 33 class Bar { |
| 34 barXYZ1 /**/ () => "barXYZ"; |
| 35 barXYZ2 /**/ (int i, int j) => "barXYZ${i}${j}"; |
| 36 barXYZ3 /**/ () { |
| 37 return "barXYZ"; |
| 38 } |
| 39 |
| 40 barXYZ4 /**/ (int i, int j) { |
| 41 return "barXYZ${i}${j}"; |
| 42 } |
| 43 } |
| 44 |
| 45 List<String> stops = []; |
| 46 List<String> expected = [ |
| 47 "$file:${LINE+0}:5", // after 'code' |
| 48 "$file:${LINE+1}:17", // on 'Bar' |
| 49 |
| 50 "$file:${LINE+2}:13", // on 'barXYZ1' |
| 51 "$file:${LINE+23}:16", // after 'barXYZ1', i.e. on '(' |
| 52 "$file:${LINE+23}:22", // on first '"' |
| 53 "$file:${LINE+2}:3", // on 'print' |
| 54 |
| 55 "$file:${LINE+3}:13", // on 'barXYZ2' |
| 56 "$file:${LINE+24}:28", // on 'j' |
| 57 "$file:${LINE+24}:50", // after last '"', i.e. on ';' |
| 58 "$file:${LINE+24}:34", // on first '"' |
| 59 "$file:${LINE+3}:3", // on 'print' |
| 60 |
| 61 "$file:${LINE+4}:13", // on 'barXYZ3' |
| 62 "$file:${LINE+25}:16", // after 'barXYZ3', i.e. on '(' |
| 63 "$file:${LINE+26}:5", // on 'return' |
| 64 "$file:${LINE+4}:3", // on 'print' |
| 65 |
| 66 "$file:${LINE+5}:13", // on 'barXYZ4' |
| 67 "$file:${LINE+29}:28", // on 'j' |
| 68 "$file:${LINE+30}:28", // after last '"', i.e. on ';' |
| 69 "$file:${LINE+30}:5", // on 'return' |
| 70 "$file:${LINE+5}:3", // on 'print' |
| 71 |
| 72 "$file:${LINE+6}:9", // on 'fooXYZ1' |
| 73 "$file:${LINE+12}:14", // after 'fooXYZ1', i.e. on '(' |
| 74 "$file:${LINE+12}:20", // on first '"' |
| 75 "$file:${LINE+6}:3", // on 'print' |
| 76 |
| 77 "$file:${LINE+7}:9", // on 'fooXYZ2' |
| 78 "$file:${LINE+13}:26", // on 'j' |
| 79 "$file:${LINE+13}:48", // after last '"', i.e. on ';' |
| 80 "$file:${LINE+13}:32", // on first '"' |
| 81 "$file:${LINE+7}:3", // on 'print' |
| 82 |
| 83 "$file:${LINE+8}:9", // on 'fooXYZ3' |
| 84 "$file:${LINE+14}:14", // after 'fooXYZ3', i.e. on '(' |
| 85 "$file:${LINE+15}:3", // on 'return' |
| 86 "$file:${LINE+8}:3", // on 'print' |
| 87 |
| 88 "$file:${LINE+9}:9", // on 'fooXYZ4' |
| 89 "$file:${LINE+18}:26", // on 'j' |
| 90 "$file:${LINE+19}:26", // after last '"', i.e. on ';' |
| 91 "$file:${LINE+19}:3", // on 'return' |
| 92 "$file:${LINE+9}:3", // on 'print' |
| 93 |
| 94 "$file:${LINE+10}:1" // on ending '}' |
| 95 ]; |
| 96 |
| 97 var tests = [ |
| 98 hasPausedAtStart, |
| 99 setBreakpointAtLine(LINE), |
| 100 runStepIntoThroughProgramRecordingStops(stops), |
| 101 checkRecordedStops(stops, expected, |
| 102 debugPrint: true, debugPrintFile: file, debugPrintLine: LINE) |
| 103 ]; |
| 104 |
| 105 main(args) { |
| 106 runIsolateTestsSynchronous(args, tests, |
| 107 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
| 108 } |
OLD | NEW |