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 library test.services.completion.contributor.dart.importuri; | 5 library test.services.completion.contributor.dart.importuri; |
6 | 6 |
7 import 'package:analysis_server/plugin/protocol/protocol.dart'; | 7 import 'package:analysis_server/plugin/protocol/protocol.dart'; |
8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 8 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
9 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar
t'; | 9 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar
t'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 test_import_package2() async { | 251 test_import_package2() async { |
252 addPackageSource('foo', 'foo.dart', 'library foo;'); | 252 addPackageSource('foo', 'foo.dart', 'library foo;'); |
253 addPackageSource('foo', 'baz/too.dart', 'library too;'); | 253 addPackageSource('foo', 'baz/too.dart', 'library too;'); |
254 addPackageSource('bar', 'bar.dart', 'library bar;'); | 254 addPackageSource('bar', 'bar.dart', 'library bar;'); |
255 addTestSource('import "package:foo/baz/^" import'); | 255 addTestSource('import "package:foo/baz/^" import'); |
256 await computeSuggestions(); | 256 await computeSuggestions(); |
257 assertSuggest('package:foo/baz/too.dart', | 257 assertSuggest('package:foo/baz/too.dart', |
258 csKind: CompletionSuggestionKind.IMPORT); | 258 csKind: CompletionSuggestionKind.IMPORT); |
259 } | 259 } |
260 | 260 |
| 261 test_import_package2_with_trailing() async { |
| 262 addPackageSource('foo', 'foo.dart', 'library foo;'); |
| 263 addPackageSource('foo', 'baz/too.dart', 'library too;'); |
| 264 addPackageSource('bar', 'bar.dart', 'library bar;'); |
| 265 addTestSource('import "package:foo/baz/^.dart" import'); |
| 266 await computeSuggestions(); |
| 267 assertSuggest('package:foo/baz/too.dart', |
| 268 csKind: CompletionSuggestionKind.IMPORT); |
| 269 expect(replacementOffset, completionOffset - 16); |
| 270 expect(replacementLength, 5 + 16); |
| 271 } |
| 272 |
261 test_import_package2_raw() async { | 273 test_import_package2_raw() async { |
262 addPackageSource('foo', 'foo.dart', 'library foo;'); | 274 addPackageSource('foo', 'foo.dart', 'library foo;'); |
263 addPackageSource('foo', 'baz/too.dart', 'library too;'); | 275 addPackageSource('foo', 'baz/too.dart', 'library too;'); |
264 addPackageSource('bar', 'bar.dart', 'library bar;'); | 276 addPackageSource('bar', 'bar.dart', 'library bar;'); |
265 addTestSource('import r"package:foo/baz/^" import'); | 277 addTestSource('import r"package:foo/baz/^" import'); |
266 await computeSuggestions(); | 278 await computeSuggestions(); |
267 assertSuggest('package:foo/baz/too.dart', | 279 assertSuggest('package:foo/baz/too.dart', |
268 csKind: CompletionSuggestionKind.IMPORT); | 280 csKind: CompletionSuggestionKind.IMPORT); |
269 } | 281 } |
270 | 282 |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
552 assertNotSuggested('foo/'); | 564 assertNotSuggested('foo/'); |
553 assertNotSuggested('foo/bar.dart'); | 565 assertNotSuggested('foo/bar.dart'); |
554 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); | 566 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); |
555 } | 567 } |
556 } | 568 } |
557 | 569 |
558 class _TestWinResourceProvider extends MemoryResourceProvider { | 570 class _TestWinResourceProvider extends MemoryResourceProvider { |
559 @override | 571 @override |
560 Context get pathContext => windows; | 572 Context get pathContext => windows; |
561 } | 573 } |
OLD | NEW |