OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 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 | 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 | 4 |
5 import 'test_helper.dart'; | 5 import 'test_helper.dart'; |
6 import 'service_test_common.dart'; | 6 import 'service_test_common.dart'; |
7 | 7 |
8 const int LINE_A = 12; | 8 const int LINE_A = 12; |
9 const String file = "next_through_for_loop_with_break_and_continue_test.dart"; | 9 const String file = "next_through_for_loop_with_break_and_continue_test.dart"; |
10 | 10 |
11 code() { | 11 code() { |
12 int count = 0; | 12 int count = 0; |
13 for (int i = 0; i < 42; ++i) { | 13 for(int i = 0; i < 42; ++i) { |
14 if (i == 2) { | 14 if (i == 2) { |
15 continue; | 15 continue; |
16 } | 16 } |
17 if (i == 3) { | 17 if (i == 3) { |
18 break; | 18 break; |
19 } | 19 } |
20 count++; | 20 count++; |
21 } | 21 } |
22 print(count); | 22 print(count); |
23 } | 23 } |
24 | 24 |
25 List<String> stops = []; | 25 List<String> stops = []; |
26 List<String> expected = [ | 26 List<String> expected = [ |
27 // Initialization (on '='), loop start (on '='), | 27 // Initialization (on '='), loop start (on '='), |
28 // first iteration (on '<', on '==', on '==', on '++') | 28 // first iteration (on '<', on '==', on '==', on '++') |
29 "$file:${LINE_A+0}:13", | 29 "$file:${LINE_A+0}:13", |
30 "$file:${LINE_A+1}:14", | 30 "$file:${LINE_A+1}:13", |
31 "$file:${LINE_A+1}:21", | 31 "$file:${LINE_A+1}:20", |
32 "$file:${LINE_A+2}:11", | 32 "$file:${LINE_A+2}:11", |
33 "$file:${LINE_A+5}:11", | 33 "$file:${LINE_A+5}:11", |
34 "$file:${LINE_A+8}:10", | 34 "$file:${LINE_A+8}:10", |
35 | 35 |
36 // Second iteration of loop: Full run | 36 // Second iteration of loop: Full run |
37 // (on '++', on '<', on '==', on '==', on '++') | 37 // (on '++', on '<', on '==', on '==', on '++') |
38 "$file:${LINE_A+1}:27", | 38 "$file:${LINE_A+1}:26", |
39 "$file:${LINE_A+1}:21", | 39 "$file:${LINE_A+1}:20", |
40 "$file:${LINE_A+2}:11", | 40 "$file:${LINE_A+2}:11", |
41 "$file:${LINE_A+5}:11", | 41 "$file:${LINE_A+5}:11", |
42 "$file:${LINE_A+8}:10", | 42 "$file:${LINE_A+8}:10", |
43 | 43 |
44 // Third iteration of loop: continue | 44 // Third iteration of loop: continue |
45 // (on '++', on '<', on '==', on 'continue') | 45 // (on '++', on '<', on '==', on 'continue') |
46 "$file:${LINE_A+1}:27", | 46 "$file:${LINE_A+1}:26", |
47 "$file:${LINE_A+1}:21", | 47 "$file:${LINE_A+1}:20", |
48 "$file:${LINE_A+2}:11", | 48 "$file:${LINE_A+2}:11", |
49 "$file:${LINE_A+3}:7", | 49 "$file:${LINE_A+3}:7", |
50 | 50 |
51 // Forth iteration of loop: break | 51 // Forth iteration of loop: break |
52 // (on '++', on '<', on '==' on '==', on 'break') | 52 // (on '++', on '<', on '==' on '==', on 'break') |
53 "$file:${LINE_A+1}:27", | 53 "$file:${LINE_A+1}:26", |
54 "$file:${LINE_A+1}:21", | 54 "$file:${LINE_A+1}:20", |
55 "$file:${LINE_A+2}:11", | 55 "$file:${LINE_A+2}:11", |
56 "$file:${LINE_A+5}:11", | 56 "$file:${LINE_A+5}:11", |
57 "$file:${LINE_A+6}:7", | 57 "$file:${LINE_A+6}:7", |
58 | 58 |
59 // End (on call to 'print' and on ending '}') | 59 // End (on call to 'print' and on ending '}') |
60 "$file:${LINE_A+10}:3", | 60 "$file:${LINE_A+10}:3", |
61 "$file:${LINE_A+11}:1" | 61 "$file:${LINE_A+11}:1" |
62 ]; | 62 ]; |
63 | 63 |
64 var tests = [ | 64 var tests = [ |
65 hasPausedAtStart, | 65 hasPausedAtStart, |
66 setBreakpointAtLine(LINE_A), | 66 setBreakpointAtLine(LINE_A), |
67 runStepThroughProgramRecordingStops(stops), | 67 runStepThroughProgramRecordingStops(stops), |
68 checkRecordedStops(stops, expected) | 68 checkRecordedStops(stops, expected) |
69 ]; | 69 ]; |
70 | 70 |
71 main(args) { | 71 main(args) { |
72 runIsolateTestsSynchronous(args, tests, | 72 runIsolateTestsSynchronous(args, tests, |
73 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); | 73 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
74 } | 74 } |
OLD | NEW |