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_catch_test.dart"; | 9 const String file = "next_through_catch_test.dart"; |
10 | 10 |
11 code() { | 11 code() { |
12 try { | 12 try { |
13 var value = "world"; | 13 var value = "world"; |
14 throw "Hello, $value"; | 14 throw "Hello, $value"; |
15 } catch (e, st) { | 15 } catch(e, st) { |
16 print(e); | 16 print(e); |
17 print(st); | 17 print(st); |
18 } | 18 } |
19 try { | 19 try { |
20 throw "Hello, world"; | 20 throw "Hello, world"; |
21 } catch (e, st) { | 21 } catch(e, st) { |
22 print(e); | 22 print(e); |
23 print(st); | 23 print(st); |
24 } | 24 } |
25 } | 25 } |
26 | 26 |
27 List<String> stops = []; | 27 List<String> stops = []; |
28 List<String> expected = [ | 28 List<String> expected = [ |
29 "$file:${LINE_A+1}:15", // on '=' | 29 "$file:${LINE_A+1}:15", // on '=' |
30 "$file:${LINE_A+2}:26", // after last '"' (i.e. before ';') | 30 "$file:${LINE_A+2}:26", // after last '"' (i.e. before ';') |
31 "$file:${LINE_A+4}:5", // on call to 'print' | 31 "$file:${LINE_A+4}:5", // on call to 'print' |
32 "$file:${LINE_A+5}:5", // on call to 'print' | 32 "$file:${LINE_A+5}:5", // on call to 'print' |
33 "$file:${LINE_A+8}:5", // on 'throw' | 33 "$file:${LINE_A+8}:5", // on 'throw' |
34 "$file:${LINE_A+10}:5", // on call to 'print' | 34 "$file:${LINE_A+10}:5", // on call to 'print' |
35 "$file:${LINE_A+11}:5", // on call to 'print' | 35 "$file:${LINE_A+11}:5", // on call to 'print' |
36 "$file:${LINE_A+13}:1" // on ending '}' | 36 "$file:${LINE_A+13}:1" // on ending '}' |
37 ]; | 37 ]; |
38 | 38 |
39 var tests = [ | 39 var tests = [ |
40 hasPausedAtStart, | 40 hasPausedAtStart, |
41 setBreakpointAtLine(LINE_A), | 41 setBreakpointAtLine(LINE_A), |
42 runStepThroughProgramRecordingStops(stops), | 42 runStepThroughProgramRecordingStops(stops), |
43 checkRecordedStops(stops, expected) | 43 checkRecordedStops(stops, expected) |
44 ]; | 44 ]; |
45 | 45 |
46 main(args) { | 46 main(args) { |
47 runIsolateTestsSynchronous(args, tests, | 47 runIsolateTestsSynchronous(args, tests, |
48 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); | 48 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
49 } | 49 } |
OLD | NEW |