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

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

Issue 646773002: include imported elements in interpolation suggestions (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
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.util; 5 library test.services.completion.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart' as protocol show Element, 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element,
10 ElementKind; 10 ElementKind;
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after
982 assertNotSuggested('f'); 982 assertNotSuggested('f');
983 assertNotSuggested('x'); 983 assertNotSuggested('x');
984 assertNotSuggested('foo'); 984 assertNotSuggested('foo');
985 assertNotSuggested('F1'); 985 assertNotSuggested('F1');
986 assertNotSuggested('F2'); 986 assertNotSuggested('F2');
987 assertNotSuggested('T1'); 987 assertNotSuggested('T1');
988 assertNotSuggested('T2'); 988 assertNotSuggested('T2');
989 }); 989 });
990 } 990 }
991 991
992 test_InterpolationExpression() {
993 // SimpleIdentifier InterpolationExpression StringInterpolation
994 addTestSource('main() {String name; print("hello \$^");}');
995 computeFast();
996 return computeFull(true).then((_) {
997 assertSuggestLocalVariable('name', 'String');
998 assertSuggestImportedClass('Object');
999 });
1000 }
1001
1002 test_InterpolationExpression_block() {
1003 // SimpleIdentifier InterpolationExpression StringInterpolation
1004 addTestSource('main() {String name; print("hello \${n^}");}');
1005 computeFast();
1006 return computeFull(true).then((_) {
1007 assertSuggestLocalVariable('name', 'String');
1008 assertSuggestImportedClass('Object');
1009 });
1010 }
1011
1012 test_InterpolationExpression_prefix_selector() {
1013 // SimpleIdentifier PrefixedIdentifier InterpolationExpression
1014 addTestSource('main() {String name; print("hello \${name.^}");}');
1015 computeFast();
1016 return computeFull(true).then((_) {
1017 assertSuggestInvocationGetter('length', 'int');
1018 assertNotSuggested('name');
1019 assertNotSuggested('Object');
1020 });
1021 }
1022
1023 test_InterpolationExpression_prefix_target() {
1024 // SimpleIdentifier PrefixedIdentifier InterpolationExpression
1025 addTestSource('main() {String name; print("hello \${nam^e.length}");}');
1026 computeFast();
1027 return computeFull(true).then((_) {
1028 assertSuggestLocalVariable('name', 'String');
1029 assertSuggestImportedClass('Object');
1030 assertNotSuggested('length');
1031 });
1032 }
1033
992 test_IsExpression() { 1034 test_IsExpression() {
993 // SimpleIdentifier TypeName IsExpression IfStatement 1035 // SimpleIdentifier TypeName IsExpression IfStatement
994 addSource('/testB.dart', ''' 1036 addSource('/testB.dart', '''
995 lib B; 1037 lib B;
996 foo() { } 1038 foo() { }
997 class X {X.c(); X._d(); z() {}}'''); 1039 class X {X.c(); X._d(); z() {}}''');
998 addTestSource(''' 1040 addTestSource('''
999 import "/testB.dart"; 1041 import "/testB.dart";
1000 class Y {Y.c(); Y._d(); z() {}} 1042 class Y {Y.c(); Y._d(); z() {}}
1001 main() {var x; if (x is ^) { }}'''); 1043 main() {var x; if (x is ^) { }}''');
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 assertSuggestInvocationSetter('_s2'); 1107 assertSuggestInvocationSetter('_s2');
1066 assertSuggestInvocationMethod('m', 'A', null); 1108 assertSuggestInvocationMethod('m', 'A', null);
1067 assertSuggestInvocationMethod('_n', 'A', 'I'); 1109 assertSuggestInvocationMethod('_n', 'A', 'I');
1068 assertNotSuggested('a'); 1110 assertNotSuggested('a');
1069 assertNotSuggested('A'); 1111 assertNotSuggested('A');
1070 assertNotSuggested('X'); 1112 assertNotSuggested('X');
1071 assertNotSuggested('Object'); 1113 assertNotSuggested('Object');
1072 }); 1114 });
1073 } 1115 }
1074 1116
1075 test_PrefixedIdentifier_interpolation() {
1076 // SimpleIdentifier PrefixedIdentifier InterpolationExpression
1077 addTestSource('main() {String name; print("hello \${name.^}");}');
1078 computeFast();
1079 return computeFull(true).then((_) {
1080 assertSuggestInvocationGetter('length', 'int');
1081 assertNotSuggested('name');
1082 assertNotSuggested('Object');
1083 });
1084 }
1085
1086 test_PrefixedIdentifier_library() { 1117 test_PrefixedIdentifier_library() {
1087 // SimpleIdentifier PrefixedIdentifier ExpressionStatement 1118 // SimpleIdentifier PrefixedIdentifier ExpressionStatement
1088 addSource('/testB.dart', ''' 1119 addSource('/testB.dart', '''
1089 lib B; 1120 lib B;
1090 var T1; 1121 var T1;
1091 class X { } 1122 class X { }
1092 class Y { }'''); 1123 class Y { }''');
1093 addTestSource(''' 1124 addTestSource('''
1094 import "/testB.dart" as b; 1125 import "/testB.dart" as b;
1095 var T2; 1126 var T2;
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1135 computeFast(); 1166 computeFast();
1136 return computeFull(true).then((_) { 1167 return computeFull(true).then((_) {
1137 assertSuggestImportedClass('A'); 1168 assertSuggestImportedClass('A');
1138 assertSuggestLocalClass('X'); 1169 assertSuggestLocalClass('X');
1139 assertSuggestLocalMethod('foo', 'X', null); 1170 assertSuggestLocalMethod('foo', 'X', null);
1140 assertNotSuggested('bar'); 1171 assertNotSuggested('bar');
1141 assertNotSuggested('_B'); 1172 assertNotSuggested('_B');
1142 }); 1173 });
1143 } 1174 }
1144 1175
1145 test_PrefixedIdentifier_prefix_interpolation() {
1146 // SimpleIdentifier PrefixedIdentifier InterpolationExpression
1147 addTestSource('main() {String name; print("hello \${nam^e.length}");}');
1148 computeFast();
1149 return computeFull(true).then((_) {
1150 assertSuggestLocalVariable('name', 'String');
1151 assertSuggestImportedClass('Object');
1152 assertNotSuggested('length');
1153 });
1154 }
1155
1156 test_TopLevelVariableDeclaration_typed_name() { 1176 test_TopLevelVariableDeclaration_typed_name() {
1157 // SimpleIdentifier VariableDeclaration VariableDeclarationList 1177 // SimpleIdentifier VariableDeclaration VariableDeclarationList
1158 // TopLevelVariableDeclaration 1178 // TopLevelVariableDeclaration
1159 addTestSource('class A {} B ^'); 1179 addTestSource('class A {} B ^');
1160 computeFast(); 1180 computeFast();
1161 return computeFull(true).then((_) { 1181 return computeFull(true).then((_) {
1162 assertNoSuggestions(); 1182 assertNoSuggestions();
1163 }); 1183 });
1164 } 1184 }
1165 1185
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
1232 addTestSource(''' 1252 addTestSource('''
1233 import "/testB.dart"; 1253 import "/testB.dart";
1234 class Y {Y.c(); Y._d(); z() {}} 1254 class Y {Y.c(); Y._d(); z() {}}
1235 main() {var ^}'''); 1255 main() {var ^}''');
1236 computeFast(); 1256 computeFast();
1237 return computeFull(true).then((_) { 1257 return computeFull(true).then((_) {
1238 assertNoSuggestions(); 1258 assertNoSuggestions();
1239 }); 1259 });
1240 } 1260 }
1241 } 1261 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698