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

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

Issue 1158413003: remove keyword suggestions in constructor names and prefixed expressions (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 921 matching lines...) Expand 10 before | Expand all | Expand 10 after
932 expect(computeFast(), isTrue); 932 expect(computeFast(), isTrue);
933 assertNoSuggestions(); 933 assertNoSuggestions();
934 } 934 }
935 935
936 test_named_constructor_invocation() { 936 test_named_constructor_invocation() {
937 addTestSource('void main() {new Future.^}'); 937 addTestSource('void main() {new Future.^}');
938 expect(computeFast(), isTrue); 938 expect(computeFast(), isTrue);
939 assertSuggestKeywords([]); 939 assertSuggestKeywords([]);
940 } 940 }
941 941
942 test_newInstance() {
943 addTestSource('class A { foo() {new ^}}');
944 expect(computeFast(), isTrue);
945 assertSuggestKeywords([]);
946 }
947
948 test_newInstance2() {
949 addTestSource('class A { foo() {new ^ print("foo");}}');
950 expect(computeFast(), isTrue);
951 assertSuggestKeywords([]);
952 }
953
954 test_newInstance_prefixed() {
955 addTestSource('class A { foo() {new A.^}}');
956 expect(computeFast(), isTrue);
957 assertSuggestKeywords([]);
958 }
959
960 test_newInstance_prefixed2() {
961 addTestSource('class A { foo() {new A.^ print("foo");}}');
962 expect(computeFast(), isTrue);
963 assertSuggestKeywords([]);
964 }
965
942 test_part_of() { 966 test_part_of() {
943 addTestSource('part of foo;^'); 967 addTestSource('part of foo;^');
944 expect(computeFast(), isTrue); 968 expect(computeFast(), isTrue);
945 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, 969 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS,
946 relevance: DART_RELEVANCE_HIGH); 970 relevance: DART_RELEVANCE_HIGH);
947 } 971 }
948 972
949 test_partial_class() { 973 test_partial_class() {
950 addTestSource('cl^'); 974 addTestSource('cl^');
951 expect(computeFast(), isTrue); 975 expect(computeFast(), isTrue);
952 assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS, 976 assertSuggestKeywords(DIRECTIVE_DECLARATION_AND_LIBRARY_KEYWORDS,
953 relevance: DART_RELEVANCE_HIGH); 977 relevance: DART_RELEVANCE_HIGH);
954 } 978 }
955 979
956 test_partial_class2() { 980 test_partial_class2() {
957 addTestSource('library a; cl^'); 981 addTestSource('library a; cl^');
958 expect(computeFast(), isTrue); 982 expect(computeFast(), isTrue);
959 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS, 983 assertSuggestKeywords(DIRECTIVE_AND_DECLARATION_KEYWORDS,
960 relevance: DART_RELEVANCE_HIGH); 984 relevance: DART_RELEVANCE_HIGH);
961 } 985 }
962 986
987 test_prefixed_field() {
988 addTestSource('class A { int x; foo() {x.^}}');
989 expect(computeFast(), isTrue);
990 assertSuggestKeywords([]);
991 }
992
993 test_prefixed_field2() {
994 addTestSource('class A { int x; foo() {x.^ print("foo");}}');
995 expect(computeFast(), isTrue);
996 assertSuggestKeywords([]);
997 }
998
999 test_prefixed_local() {
1000 addTestSource('class A { foo() {int x; x.^}}');
1001 expect(computeFast(), isTrue);
1002 assertSuggestKeywords([]);
1003 }
1004
1005 test_prefixed_local2() {
1006 addTestSource('class A { foo() {int x; x.^ print("foo");}}');
1007 expect(computeFast(), isTrue);
1008 assertSuggestKeywords([]);
1009 }
1010
963 test_switch_expression() { 1011 test_switch_expression() {
964 addTestSource('main() {switch(^) {}}'); 1012 addTestSource('main() {switch(^) {}}');
965 expect(computeFast(), isTrue); 1013 expect(computeFast(), isTrue);
966 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE); 1014 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
967 } 1015 }
968 1016
969 test_switch_expression2() { 1017 test_switch_expression2() {
970 addTestSource('main() {switch(n^) {}}'); 1018 addTestSource('main() {switch(n^) {}}');
971 expect(computeFast(), isTrue); 1019 expect(computeFast(), isTrue);
972 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE); 1020 assertSuggestKeywords(EXPRESSION_START_NO_INSTANCE);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
1026 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}')); 1074 (c) => msg.writeln(' $c, ${other.contains(c) ? '' : '<<<<<<<<<<<'}'));
1027 } 1075 }
1028 1076
1029 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) { 1077 bool _equalSets(Iterable<String> iter1, Iterable<String> iter2) {
1030 if (iter1.length != iter2.length) return false; 1078 if (iter1.length != iter2.length) return false;
1031 if (iter1.any((c) => !iter2.contains(c))) return false; 1079 if (iter1.any((c) => !iter2.contains(c))) return false;
1032 if (iter2.any((c) => !iter1.contains(c))) return false; 1080 if (iter2.any((c) => !iter1.contains(c))) return false;
1033 return true; 1081 return true;
1034 } 1082 }
1035 } 1083 }
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