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_switch_test.dart"; |
| 10 |
| 11 code() { |
| 12 code2('a'); |
| 13 code2('b'); |
| 14 code2('c'); |
| 15 code2('d'); |
| 16 } |
| 17 |
| 18 code2(String key) { |
| 19 switch (key) { |
| 20 case "a": |
| 21 print("a!"); |
| 22 break; |
| 23 case "b": |
| 24 case "c": |
| 25 print("b or c!"); |
| 26 break; |
| 27 default: |
| 28 print("neither a, b or c..."); |
| 29 } |
| 30 } |
| 31 |
| 32 List<String> stops = []; |
| 33 List<String> expected = [ |
| 34 "$file:${LINE+0}:5", // after 'code' |
| 35 |
| 36 "$file:${LINE+1}:3", // on 'code2' |
| 37 "$file:${LINE+7}:14", // on 'key' |
| 38 "$file:${LINE+9}:10", // on first '"' on 'case "a"' line |
| 39 "$file:${LINE+10}:7", // on 'print' |
| 40 "$file:${LINE+11}:7", // on 'break' |
| 41 "$file:${LINE+19}:1", // on '}' |
| 42 |
| 43 "$file:${LINE+2}:3", // on 'code2' |
| 44 "$file:${LINE+7}:14", // on 'key' |
| 45 "$file:${LINE+9}:10", // on first '"' on 'case "a"' line |
| 46 "$file:${LINE+12}:10", // on first '"' on 'case "b"' line |
| 47 "$file:${LINE+14}:7", // on 'print' |
| 48 "$file:${LINE+15}:7", // on 'break' |
| 49 "$file:${LINE+19}:1", // on '}' |
| 50 |
| 51 "$file:${LINE+3}:3", // on 'code2' |
| 52 "$file:${LINE+7}:14", // on 'key' |
| 53 "$file:${LINE+9}:10", // on first '"' on 'case "a"' line |
| 54 "$file:${LINE+12}:10", // on first '"' on 'case "b"' line |
| 55 "$file:${LINE+13}:10", // on first '"' on 'case "c"' line |
| 56 "$file:${LINE+14}:7", // on 'print' |
| 57 "$file:${LINE+15}:7", // on 'break' |
| 58 "$file:${LINE+19}:1", // on '}' |
| 59 |
| 60 "$file:${LINE+4}:3", // on 'code2' |
| 61 "$file:${LINE+7}:14", // on 'key' |
| 62 "$file:${LINE+9}:10", // on first '"' on 'case "a"' line |
| 63 "$file:${LINE+12}:10", // on first '"' on 'case "b"' line |
| 64 "$file:${LINE+13}:10", // on first '"' on 'case "c"' line |
| 65 "$file:${LINE+17}:7", // on 'print' |
| 66 "$file:${LINE+19}:1", // on '}' |
| 67 |
| 68 "$file:${LINE+5}:1" // on ending '}' |
| 69 ]; |
| 70 |
| 71 var tests = [ |
| 72 hasPausedAtStart, |
| 73 setBreakpointAtLine(LINE), |
| 74 runStepIntoThroughProgramRecordingStops(stops), |
| 75 checkRecordedStops(stops, expected, |
| 76 debugPrint: true, debugPrintFile: file, debugPrintLine: LINE) |
| 77 ]; |
| 78 |
| 79 main(args) { |
| 80 runIsolateTestsSynchronous(args, tests, |
| 81 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
| 82 } |
OLD | NEW |