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 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 const int LINE_A = 13; | 9 const int LINE_A = 13; |
10 const String file = "next_through_simple_async_test.dart"; | 10 const String file = "next_through_simple_async_test.dart"; |
11 | 11 |
12 // line A is at the "code() async" line | 12 // line A is at the "code() async" line |
13 code() async { | 13 code() async { |
14 File f = new File(Platform.script.path); | 14 File f = new File(Platform.script.toFilePath()); |
15 DateTime modified = await f.lastModified(); | 15 DateTime modified = await f.lastModified(); |
16 bool exists = await f.exists(); | 16 bool exists = await f.exists(); |
17 print("Modified: $modified; exists: $exists"); | 17 print("Modified: $modified; exists: $exists"); |
18 foo(); | 18 foo(); |
19 } | 19 } |
20 | 20 |
21 foo() { | 21 foo() { |
22 print("Hello from Foo!"); | 22 print("Hello from Foo!"); |
23 } | 23 } |
24 | 24 |
25 List<String> stops = []; | 25 List<String> stops = []; |
26 List<String> expected = [ | 26 List<String> expected = [ |
27 "$file:${LINE_A+0}:5", // on '(' in code()' | 27 "$file:${LINE_A+0}:5", // on '(' in code()' |
28 "$file:${LINE_A+1}:30", // on 'script' | 28 "$file:${LINE_A+1}:30", // on 'script' |
29 "$file:${LINE_A+1}:37", // on 'path' | 29 "$file:${LINE_A+1}:37", // on 'toFilePath' |
30 "$file:${LINE_A+1}:16", // on File | 30 "$file:${LINE_A+1}:16", // on File |
31 "$file:${LINE_A+2}:31", // on 'lastModified' | 31 "$file:${LINE_A+2}:31", // on 'lastModified' |
32 "$file:${LINE_A+2}:23", // on 'await' | 32 "$file:${LINE_A+2}:23", // on 'await' |
33 "$file:${LINE_A+3}:25", // on 'exists' | 33 "$file:${LINE_A+3}:25", // on 'exists' |
34 "$file:${LINE_A+3}:17", // on 'await' | 34 "$file:${LINE_A+3}:17", // on 'await' |
35 "$file:${LINE_A+4}:47", // on ')', i.e. before ';' | 35 "$file:${LINE_A+4}:47", // on ')', i.e. before ';' |
36 "$file:${LINE_A+4}:3", // on call to 'print' | 36 "$file:${LINE_A+4}:3", // on call to 'print' |
37 "$file:${LINE_A+5}:3", // on call to 'foo' | 37 "$file:${LINE_A+5}:3", // on call to 'foo' |
38 "$file:${LINE_A+6}:1" // ending '}' | 38 "$file:${LINE_A+6}:1" // ending '}' |
39 ]; | 39 ]; |
40 | 40 |
41 var tests = [ | 41 var tests = [ |
42 hasPausedAtStart, | 42 hasPausedAtStart, |
43 setBreakpointAtLine(LINE_A), | 43 setBreakpointAtLine(LINE_A), |
44 runStepThroughProgramRecordingStops(stops), | 44 runStepThroughProgramRecordingStops(stops), |
45 checkRecordedStops(stops, expected) | 45 checkRecordedStops(stops, expected) |
46 ]; | 46 ]; |
47 | 47 |
48 main(args) { | 48 main(args) { |
49 runIsolateTestsSynchronous(args, tests, | 49 runIsolateTestsSynchronous(args, tests, |
50 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); | 50 testeeConcurrent: code, pause_on_start: true, pause_on_exit: true); |
51 } | 51 } |
OLD | NEW |