Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(489)

Side by Side Diff: pkg/analysis_server/test/services/completion/keyword_contributor_test.dart

Issue 1151493004: no keyword suggestions in library identifier or property accessor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.dart.keyword; 5 library test.services.completion.dart.keyword;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart'; 8 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
9 import 'package:analysis_server/src/services/completion/keyword_contributor.dart '; 9 import 'package:analysis_server/src/services/completion/keyword_contributor.dart ';
10 import 'package:analyzer/src/generated/scanner.dart'; 10 import 'package:analyzer/src/generated/scanner.dart';
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after
792 assertSuggestKeywords([], relevance: DART_RELEVANCE_HIGH); 792 assertSuggestKeywords([], relevance: DART_RELEVANCE_HIGH);
793 } 793 }
794 794
795 test_library() { 795 test_library() {
796 addTestSource('library foo;^'); 796 addTestSource('library foo;^');
797 expect(computeFast(), isTrue); 797 expect(computeFast(), isTrue);
798 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, 798 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS,
799 relevance: DART_RELEVANCE_HIGH); 799 relevance: DART_RELEVANCE_HIGH);
800 } 800 }
801 801
802 test_library_declaration() {
803 addTestSource('library ^');
804 expect(computeFast(), isTrue);
805 assertSuggestKeywords([]);
806 }
807
808 test_library_declaration2() {
809 addTestSource('library a^');
810 expect(computeFast(), isTrue);
811 assertSuggestKeywords([]);
812 }
813
814 test_library_declaration3() {
815 addTestSource('library a.^');
816 expect(computeFast(), isTrue);
817 assertSuggestKeywords([]);
818 }
819
802 test_library_name() { 820 test_library_name() {
803 addTestSource('library ^'); 821 addTestSource('library ^');
804 expect(computeFast(), isTrue); 822 expect(computeFast(), isTrue);
805 assertSuggestKeywords([]); 823 assertSuggestKeywords([]);
806 } 824 }
807 825
808 test_method_async() { 826 test_method_async() {
809 addTestSource('class A { foo() ^}'); 827 addTestSource('class A { foo() ^}');
810 expect(computeFast(), isTrue); 828 expect(computeFast(), isTrue);
811 assertSuggestKeywords(CLASS_BODY_KEYWORDS, pseudoKeywords: ['async']); 829 assertSuggestKeywords(CLASS_BODY_KEYWORDS, pseudoKeywords: ['async']);
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
989 expect(computeFast(), isTrue); 1007 expect(computeFast(), isTrue);
990 assertSuggestKeywords([]); 1008 assertSuggestKeywords([]);
991 } 1009 }
992 1010
993 test_prefixed_field2() { 1011 test_prefixed_field2() {
994 addTestSource('class A { int x; foo() {x.^ print("foo");}}'); 1012 addTestSource('class A { int x; foo() {x.^ print("foo");}}');
995 expect(computeFast(), isTrue); 1013 expect(computeFast(), isTrue);
996 assertSuggestKeywords([]); 1014 assertSuggestKeywords([]);
997 } 1015 }
998 1016
1017 test_prefixed_library() {
1018 addTestSource('import "b" as b; class A { foo() {b.^}}');
1019 expect(computeFast(), isTrue);
1020 assertSuggestKeywords([]);
1021 }
1022
999 test_prefixed_local() { 1023 test_prefixed_local() {
1000 addTestSource('class A { foo() {int x; x.^}}'); 1024 addTestSource('class A { foo() {int x; x.^}}');
1001 expect(computeFast(), isTrue); 1025 expect(computeFast(), isTrue);
1002 assertSuggestKeywords([]); 1026 assertSuggestKeywords([]);
1003 } 1027 }
1004 1028
1005 test_prefixed_local2() { 1029 test_prefixed_local2() {
1006 addTestSource('class A { foo() {int x; x.^ print("foo");}}'); 1030 addTestSource('class A { foo() {int x; x.^ print("foo");}}');
1007 expect(computeFast(), isTrue); 1031 expect(computeFast(), isTrue);
1008 assertSuggestKeywords([]); 1032 assertSuggestKeywords([]);
1009 } 1033 }
1010 1034
1035 test_property_access() {
1036 addTestSource('class A { get x => 7; foo() {new A().^}}');
1037 expect(computeFast(), isTrue);
1038 assertSuggestKeywords([]);
1039 }
1040
1011 test_switch_expression() { 1041 test_switch_expression() {
1012 addTestSource('main() {switch(^) {}}'); 1042 addTestSource('main() {switch(^) {}}');
1013 expect(computeFast(), isTrue); 1043 expect(computeFast(), isTrue);
1014 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE); 1044 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
1015 } 1045 }
1016 1046
1017 test_switch_expression2() { 1047 test_switch_expression2() {
1018 addTestSource('main() {switch(n^) {}}'); 1048 addTestSource('main() {switch(n^) {}}');
1019 expect(computeFast(), isTrue); 1049 expect(computeFast(), isTrue);
1020 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE); 1050 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1074 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); 1104 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}'));
1075 } 1105 }
1076 1106
1077 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { 1107 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) {
1078 if (iter1.length != iter2.length) return false; 1108 if (iter1.length != iter2.length) return false;
1079 if (iter1.any((c) => !iter2.contains(c))) return false; 1109 if (iter1.any((c) => !iter2.contains(c))) return false;
1080 if (iter2.any((c) => !iter1.contains(c))) return false; 1110 if (iter2.any((c) => !iter1.contains(c))) return false;
1081 return true; 1111 return true;
1082 } 1112 }
1083 } 1113 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/keyword_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698