OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 /// Test that poi.dart finds the right element. | 5 /// Test that poi.dart finds the right element. |
6 | 6 |
7 library trydart.poi_find_test; | 7 library trydart.poi_find_test; |
8 | 8 |
9 import 'dart:io' show | 9 import 'dart:io' show |
10 Platform; | 10 Platform; |
11 | 11 |
12 import 'dart:async' show | 12 import 'dart:async' show |
13 Future; | 13 Future; |
14 | 14 |
15 import 'package:try/poi/poi.dart' as poi; | 15 import 'package:try/poi/poi.dart' as poi; |
16 | 16 |
17 import 'package:async_helper/async_helper.dart'; | 17 import 'package:async_helper/async_helper.dart'; |
18 | 18 |
19 import 'package:expect/expect.dart'; | 19 import 'package:expect/expect.dart'; |
20 | 20 |
21 import 'package:compiler/implementation/elements/elements.dart' show | 21 import 'package:compiler/implementation/elements/elements.dart' show |
22 Element; | 22 Element; |
23 | 23 |
| 24 import 'package:compiler/implementation/source_file_provider.dart' show |
| 25 FormattingDiagnosticHandler; |
| 26 |
24 Future testPoi() { | 27 Future testPoi() { |
25 Uri script = Platform.script.resolve('data/empty_main.dart'); | 28 Uri script = Platform.script.resolve('data/empty_main.dart'); |
26 return poi.runPoi(script, 225).then((Element element) { | 29 FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler(); |
| 30 handler.verbose = true; |
| 31 |
| 32 Future future = poi.runPoi(script, 225, handler.provider, handler); |
| 33 return future.then((Element element) { |
27 Uri foundScript = element.compilationUnit.script.resourceUri; | 34 Uri foundScript = element.compilationUnit.script.resourceUri; |
28 Expect.stringEquals('$script', '$foundScript'); | 35 Expect.stringEquals('$script', '$foundScript'); |
29 Expect.stringEquals('main', element.name); | 36 Expect.stringEquals('main', element.name); |
30 }); | 37 }); |
31 } | 38 } |
32 | 39 |
33 void main() { | 40 void main() { |
34 asyncTest(testPoi); | 41 asyncTest(testPoi); |
35 } | 42 } |
OLD | NEW |