| 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 import 'package:analysis_server/protocol/protocol_generated.dart'; | 5 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 6 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; | 6 import 'package:analysis_server/src/provisional/completion/dart/completion_dart.
dart'; |
| 7 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar
t'; | 7 import 'package:analysis_server/src/services/completion/dart/uri_contributor.dar
t'; |
| 8 import 'package:analyzer/file_system/memory_file_system.dart'; | 8 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 9 import 'package:path/path.dart'; | 9 import 'package:path/path.dart'; |
| 10 import 'package:test/test.dart'; | 10 import 'package:test/test.dart'; |
| 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 11 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 12 | 12 |
| 13 import 'completion_contributor_util.dart'; | 13 import 'completion_contributor_util.dart'; |
| 14 | 14 |
| 15 main() { | 15 main() { |
| 16 defineReflectiveSuite(() { | 16 defineReflectiveSuite(() { |
| 17 defineReflectiveTests(UriContributorTest); | 17 defineReflectiveTests(UriContributorTest); |
| 18 defineReflectiveTests(UriContributorWindowsTest); | 18 defineReflectiveTests(UriContributorWindowsTest); |
| 19 defineReflectiveTests(UriContributorTest_Driver); | |
| 20 defineReflectiveTests(UriContributorWindowsTest_Driver); | |
| 21 }); | 19 }); |
| 22 } | 20 } |
| 23 | 21 |
| 24 @reflectiveTest | 22 @reflectiveTest |
| 25 class UriContributorTest extends DartCompletionContributorTest { | 23 class UriContributorTest extends DartCompletionContributorTest { |
| 26 @override | 24 @override |
| 25 bool get enableNewAnalysisDriver => true; |
| 26 |
| 27 @override |
| 27 DartCompletionContributor createContributor() { | 28 DartCompletionContributor createContributor() { |
| 28 return new UriContributor(); | 29 return new UriContributor(); |
| 29 } | 30 } |
| 30 | 31 |
| 31 test_after_import() async { | 32 test_after_import() async { |
| 32 addTestSource('import "p"^'); | 33 addTestSource('import "p"^'); |
| 33 await computeSuggestions(); | 34 await computeSuggestions(); |
| 34 expect(replacementOffset, completionOffset); | 35 expect(replacementOffset, completionOffset); |
| 35 expect(replacementLength, 0); | 36 expect(replacementLength, 0); |
| 36 assertNoSuggestions(); | 37 assertNoSuggestions(); |
| (...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 456 assertNotSuggested('completion.dart'); | 457 assertNotSuggested('completion.dart'); |
| 457 assertNotSuggested('other.dart'); | 458 assertNotSuggested('other.dart'); |
| 458 assertNotSuggested('foo'); | 459 assertNotSuggested('foo'); |
| 459 assertNotSuggested('foo/'); | 460 assertNotSuggested('foo/'); |
| 460 assertNotSuggested('foo/bar.dart'); | 461 assertNotSuggested('foo/bar.dart'); |
| 461 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); | 462 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); |
| 462 } | 463 } |
| 463 } | 464 } |
| 464 | 465 |
| 465 @reflectiveTest | 466 @reflectiveTest |
| 466 class UriContributorTest_Driver extends UriContributorTest { | |
| 467 @override | |
| 468 bool get enableNewAnalysisDriver => true; | |
| 469 } | |
| 470 | |
| 471 @reflectiveTest | |
| 472 class UriContributorWindowsTest extends DartCompletionContributorTest { | 467 class UriContributorWindowsTest extends DartCompletionContributorTest { |
| 473 @override | 468 @override |
| 469 bool get enableNewAnalysisDriver => true; |
| 470 |
| 471 @override |
| 474 DartCompletionContributor createContributor() { | 472 DartCompletionContributor createContributor() { |
| 475 return new UriContributor(); | 473 return new UriContributor(); |
| 476 } | 474 } |
| 477 | 475 |
| 478 @override | 476 @override |
| 479 void setupResourceProvider() { | 477 void setupResourceProvider() { |
| 480 provider = new _TestWinResourceProvider(); | 478 provider = new _TestWinResourceProvider(); |
| 481 } | 479 } |
| 482 | 480 |
| 483 test_import_file() async { | 481 test_import_file() async { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 627 expect(replacementLength, 3); | 625 expect(replacementLength, 3); |
| 628 assertNotSuggested('completion.dart'); | 626 assertNotSuggested('completion.dart'); |
| 629 assertNotSuggested('other.dart'); | 627 assertNotSuggested('other.dart'); |
| 630 assertNotSuggested('foo'); | 628 assertNotSuggested('foo'); |
| 631 assertNotSuggested('foo/'); | 629 assertNotSuggested('foo/'); |
| 632 assertNotSuggested('foo/bar.dart'); | 630 assertNotSuggested('foo/bar.dart'); |
| 633 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); | 631 assertSuggest('../blat.dart', csKind: CompletionSuggestionKind.IMPORT); |
| 634 } | 632 } |
| 635 } | 633 } |
| 636 | 634 |
| 637 @reflectiveTest | |
| 638 class UriContributorWindowsTest_Driver extends UriContributorWindowsTest { | |
| 639 @override | |
| 640 bool get enableNewAnalysisDriver => true; | |
| 641 } | |
| 642 | |
| 643 class _TestWinResourceProvider extends MemoryResourceProvider { | 635 class _TestWinResourceProvider extends MemoryResourceProvider { |
| 644 @override | 636 @override |
| 645 Context get pathContext => windows; | 637 Context get pathContext => windows; |
| 646 } | 638 } |
| OLD | NEW |