| 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/src/elements/elements.dart' show |
| 22 Element; | 22 Element; |
| 23 | 23 |
| 24 import 'package:compiler/implementation/source_file_provider.dart' show | 24 import 'package:compiler/src/source_file_provider.dart' show |
| 25 FormattingDiagnosticHandler; | 25 FormattingDiagnosticHandler; |
| 26 | 26 |
| 27 Future testPoi() { | 27 Future testPoi() { |
| 28 Uri script = Platform.script.resolve('data/empty_main.dart'); | 28 Uri script = Platform.script.resolve('data/empty_main.dart'); |
| 29 FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler(); | 29 FormattingDiagnosticHandler handler = new FormattingDiagnosticHandler(); |
| 30 handler.verbose = false; | 30 handler.verbose = false; |
| 31 | 31 |
| 32 Future future = poi.runPoi(script, 225, handler.provider, handler); | 32 Future future = poi.runPoi(script, 225, handler.provider, handler); |
| 33 return future.then((Element element) { | 33 return future.then((Element element) { |
| 34 Uri foundScript = element.compilationUnit.script.resourceUri; | 34 Uri foundScript = element.compilationUnit.script.resourceUri; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 token = poi.findToken(element, position + 5); | 67 token = poi.findToken(element, position + 5); |
| 68 Expect.isNotNull(token, 'token'); | 68 Expect.isNotNull(token, 'token'); |
| 69 Expect.equals(position + 4, token.charOffset, '$token'); | 69 Expect.equals(position + 4, token.charOffset, '$token'); |
| 70 Expect.stringEquals('(', token.value); | 70 Expect.stringEquals('(', token.value); |
| 71 }); | 71 }); |
| 72 } | 72 } |
| 73 | 73 |
| 74 void main() { | 74 void main() { |
| 75 asyncTest(testPoi); | 75 asyncTest(testPoi); |
| 76 } | 76 } |
| OLD | NEW |