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

Side by Side Diff: pkg/analysis_server/test/completion_test.dart

Issue 2975253002: Format analyzer, analysis_server, analyzer_plugin, front_end and kernel with the latest dartfmt. (Closed)
Patch Set: Created 3 years, 5 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
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection'; 6 import 'dart:collection';
7 7
8 import 'package:test/test.dart'; 8 import 'package:test/test.dart';
9 9
10 import 'completion_test_support.dart'; 10 import 'completion_test_support.dart';
(...skipping 22 matching lines...) Expand all
33 buildCommentSnippetTests(); 33 buildCommentSnippetTests();
34 buildCompletionTests(); 34 buildCompletionTests();
35 buildOtherTests(); 35 buildOtherTests();
36 buildLibraryTests(); 36 buildLibraryTests();
37 int testCount = expectedPassCount + expectedFailCount; 37 int testCount = expectedPassCount + expectedFailCount;
38 print( 38 print(
39 'Total $testCount tests, of which $expectedFailCount are expected to fai l.'); 39 'Total $testCount tests, of which $expectedFailCount are expected to fai l.');
40 } 40 }
41 41
42 void buildCommentSnippetTests() { 42 void buildCommentSnippetTests() {
43 buildTests( 43 buildTests('testCommentSnippets001', '''
44 'testCommentSnippets001',
45 '''
46 class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA!1X;x!2c.abs();nu m f = M!3AX;}}''', 44 class X {static final num MAX = 0;num yc,xc;mth() {xc = yc = MA!1X;x!2c.abs();nu m f = M!3AX;}}''',
47 <String>["1+MAX", "2+xc", "3+MAX"]); 45 <String>["1+MAX", "2+xc", "3+MAX"]);
48 46
49 buildTests( 47 buildTests('testCommentSnippets002', '''
50 'testCommentSnippets002',
51 '''
52 class Y {String x='hi';mth() {x.l!1ength;int n = 0;x!2.codeUnitAt(n!3);}}''', 48 class Y {String x='hi';mth() {x.l!1ength;int n = 0;x!2.codeUnitAt(n!3);}}''',
53 <String>["1+length", "2+x", "3+n"]); 49 <String>["1+length", "2+x", "3+n"]);
54 50
55 buildTests( 51 buildTests('testCommentSnippets004', '''
56 'testCommentSnippets004',
57 '''
58 class A {!1int x; !2mth() {!3int y = this.!5x!6;}}class B{}''', 52 class A {!1int x; !2mth() {!3int y = this.!5x!6;}}class B{}''',
59 <String>["1+A", "2+B", "3+x", "3-y", "5+mth", "6+x"]); 53 <String>["1+A", "2+B", "3+x", "3-y", "5+mth", "6+x"]);
60 54
61 buildTests( 55 buildTests('testCommentSnippets005', '''
62 'testCommentSnippets005',
63 '''
64 class Date { static Date JUN, JUL;}class X { m() { return Da!1te.JU!2L; }}''', 56 class Date { static Date JUN, JUL;}class X { m() { return Da!1te.JU!2L; }}''',
65 <String>["1+Date", "2+JUN", "2+JUL"]); 57 <String>["1+Date", "2+JUN", "2+JUL"]);
66 58
67 buildTests( 59 buildTests('testCommentSnippets007', '''
68 'testCommentSnippets007',
69 '''
70 class C {mth(Map x, !1) {}mtf(!2, Map x) {}m() {for (in!3t i=0; i<5; i++); A!4 x ;}}class int{}class Arrays{}''', 60 class C {mth(Map x, !1) {}mtf(!2, Map x) {}m() {for (in!3t i=0; i<5; i++); A!4 x ;}}class int{}class Arrays{}''',
71 <String>["1+bool", "2+bool", "3+int", "4+Arrays"]); 61 <String>["1+bool", "2+bool", "3+int", "4+Arrays"]);
72 62
73 buildTests( 63 buildTests('testCommentSnippets008', '''
74 'testCommentSnippets008', 64 class Date{}final num M = Dat!1''', <String>["1+Date"]);
75 '''
76 class Date{}final num M = Dat!1''',
77 <String>["1+Date"]);
78 65
79 // space, char, eol are important 66 // space, char, eol are important
80 buildTests( 67 buildTests(
81 'testCommentSnippets009', 68 'testCommentSnippets009',
82 ''' 69 '''
83 class Maps{}class x extends!5 !2M!3 !4implements!6 !1\n{}''', 70 class Maps{}class x extends!5 !2M!3 !4implements!6 !1\n{}''',
84 <String>[ 71 <String>[
85 "1+Map", 72 "1+Map",
86 "2+Maps", 73 "2+Maps",
87 "3+Maps", 74 "3+Maps",
88 "4-Maps", 75 "4-Maps",
89 "4+implements", 76 "4+implements",
90 "5-Maps", 77 "5-Maps",
91 "6-Map", 78 "6-Map",
92 "6+implements" 79 "6+implements"
93 ], 80 ],
94 failingTests: '46'); 81 failingTests: '46');
95 82
96 // space, char, eol are important 83 // space, char, eol are important
97 buildTests( 84 buildTests('testCommentSnippets010', '''
98 'testCommentSnippets010', 85 class x implements !1{}''', <String>["1+Map"]);
99 '''
100 class x implements !1{}''',
101 <String>["1+Map"]);
102 86
103 // space, char, eol are important 87 // space, char, eol are important
104 buildTests( 88 buildTests('testCommentSnippets011', '''
105 'testCommentSnippets011', 89 class x implements M!1{}''', <String>["1+Map"]);
106 '''
107 class x implements M!1{}''',
108 <String>["1+Map"]);
109 90
110 // space, char, eol are important 91 // space, char, eol are important
111 buildTests( 92 buildTests('testCommentSnippets012', '''
112 'testCommentSnippets012', 93 class x implements M!1\n{}''', <String>["1+Map"]);
113 '''
114 class x implements M!1\n{}''',
115 <String>["1+Map"]);
116 94
117 buildTests( 95 buildTests('testCommentSnippets013', '''
118 'testCommentSnippets013', 96 class x !2{!1}!3''', <String>["1+num", "2-num", "3+num"]);
119 '''
120 class x !2{!1}!3''',
121 <String>["1+num", "2-num", "3+num"]);
122 97
123 // trailing space is important 98 // trailing space is important
124 buildTests( 99 buildTests('testCommentSnippets014', '''
125 'testCommentSnippets014', 100 typedef n!1 ;''', <String>["1+num"]);
126 '''
127 typedef n!1 ;''',
128 <String>["1+num"]);
129 101
130 buildTests( 102 buildTests('testCommentSnippets015', '''
131 'testCommentSnippets015', 103 class D {f(){} g(){f!1(f!2);}}''', <String>["1+f", "2+f"]);
132 '''
133 class D {f(){} g(){f!1(f!2);}}''',
134 <String>["1+f", "2+f"]);
135 104
136 buildTests( 105 buildTests('testCommentSnippets016', '''
137 'testCommentSnippets016', 106 class F {m() { m(); !1}}''', <String>["1+m"]);
138 '''
139 class F {m() { m(); !1}}''',
140 <String>["1+m"]);
141 107
142 buildTests( 108 buildTests('testCommentSnippets017', '''
143 'testCommentSnippets017', 109 class F {var x = !1false;}''', <String>["1+true"]);
144 '''
145 class F {var x = !1false;}''',
146 <String>["1+true"]);
147 110
148 buildTests( 111 buildTests('testCommentSnippets018', '''
149 'testCommentSnippets018',
150 '''
151 class Map{}class Arrays{}class C{ m(!1){} n(!2 x, q)''', 112 class Map{}class Arrays{}class C{ m(!1){} n(!2 x, q)''',
152 <String>["1+Map", "1-void", "1-null", "2+Arrays", "2-void", "2-null"]); 113 <String>["1+Map", "1-void", "1-null", "2+Arrays", "2-void", "2-null"]);
153 114
154 buildTests( 115 buildTests('testCommentSnippets019', '''
155 'testCommentSnippets019', 116 class A{m(){Object x;x.!1/**/clear()''', <String>["1+toString"]);
156 '''
157 class A{m(){Object x;x.!1/**/clear()''',
158 <String>["1+toString"]);
159 117
160 buildTests( 118 buildTests('testCommentSnippets020', '''
161 'testCommentSnippets020',
162 '''
163 classMap{}class tst {var newt;void newf(){}test() {var newz;new!1/**/;}}''', 119 classMap{}class tst {var newt;void newf(){}test() {var newz;new!1/**/;}}''',
164 <String>["1+newt", "1+newf", "1+newz", "1-Map"]); 120 <String>["1+newt", "1+newf", "1+newz", "1-Map"]);
165 121
166 buildTests( 122 buildTests('testCommentSnippets021', '''
167 'testCommentSnippets021',
168 '''
169 class Map{}class tst {var newt;void newf(){}test() {var newz;new !1/**/;}}''', 123 class Map{}class tst {var newt;void newf(){}test() {var newz;new !1/**/;}}''',
170 <String>["1+Map", "1-newt"]); 124 <String>["1+Map", "1-newt"]);
171 125
172 buildTests( 126 buildTests('testCommentSnippets022', '''
173 'testCommentSnippets022', 127 class Map{}class F{m(){new !1;}}''', <String>["1+Map"]);
174 '''
175 class Map{}class F{m(){new !1;}}''',
176 <String>["1+Map"]);
177 128
178 buildTests( 129 buildTests('testCommentSnippets022a', '''
179 'testCommentSnippets022a', 130 class Map{}class F{m(){new !1''', <String>["1+Map"]);
180 '''
181 class Map{}class F{m(){new !1''',
182 <String>["1+Map"]);
183 131
184 buildTests( 132 buildTests('testCommentSnippets022b', '''
185 'testCommentSnippets022b',
186 '''
187 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''', 133 class Map{factory Map.qq(){return null;}}class F{m(){new Map.!1qq();}}''',
188 <String>["1+qq"]); 134 <String>["1+qq"]);
189 135
190 buildTests( 136 buildTests('testCommentSnippets023', '''
191 'testCommentSnippets023',
192 '''
193 class X {X c; X(this.!1c!3) : super() {c.!2}}''', 137 class X {X c; X(this.!1c!3) : super() {c.!2}}''',
194 <String>["1+c", "2+c", "3+c"]); 138 <String>["1+c", "2+c", "3+c"]);
195 139
196 buildTests( 140 buildTests('testCommentSnippets024', '''
197 'testCommentSnippets024', 141 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''', <String>["1+x", "2+x"]);
198 '''
199 class q {m(Map q){var x;m(!1)}n(){var x;n(!2)}}''',
200 <String>["1+x", "2+x"]);
201 142
202 buildTests( 143 buildTests('testCommentSnippets025', '''
203 'testCommentSnippets025',
204 '''
205 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''', 144 class q {num m() {var q; num x=!1 q!3 + !2/**/;}}''',
206 <String>["1+q", "2+q", "3+q"]); 145 <String>["1+q", "2+q", "3+q"]);
207 146
208 buildTests( 147 buildTests('testCommentSnippets026', '''
209 'testCommentSnippets026', 148 class List{}class a implements !1{}''', <String>["1+List"]);
210 '''
211 class List{}class a implements !1{}''',
212 <String>["1+List"]);
213 149
214 buildTests( 150 buildTests('testCommentSnippets027', '''
215 'testCommentSnippets027',
216 '''
217 class String{}class List{}class test <X extends !1String!2> {}''', 151 class String{}class List{}class test <X extends !1String!2> {}''',
218 <String>["1+List", "2+String", "2-List"]); 152 <String>["1+List", "2+String", "2-List"]);
219 153
220 buildTests( 154 buildTests('testCommentSnippets028', '''
221 'testCommentSnippets028',
222 '''
223 class String{}class List{}class DateTime{}typedef T Y<T extends !1>(List input); ''', 155 class String{}class List{}class DateTime{}typedef T Y<T extends !1>(List input); ''',
224 <String>["1+DateTime", "1+String"]); 156 <String>["1+DateTime", "1+String"]);
225 157
226 buildTests( 158 buildTests('testCommentSnippets029', '''
227 'testCommentSnippets029',
228 '''
229 interface A<X> default B<X extends !1List!2> {}''', 159 interface A<X> default B<X extends !1List!2> {}''',
230 <String>["1+DateTime", "2+List"]); 160 <String>["1+DateTime", "2+List"]);
231 161
232 buildTests( 162 buildTests(
233 'testCommentSnippets030', 163 'testCommentSnippets030',
234 ''' 164 '''
235 class Bar<T extends Foo> {const Bar(!1T!2 k);T!3 m(T!4 a, T!5 b){}final T!6 f = null;}''', 165 class Bar<T extends Foo> {const Bar(!1T!2 k);T!3 m(T!4 a, T!5 b){}final T!6 f = null;}''',
236 <String>["1+T", "2+T", "3+T", "4+T", "5+T", "6+T"], 166 <String>["1+T", "2+T", "3+T", "4+T", "5+T", "6+T"],
237 failingTests: '123456'); 167 failingTests: '123456');
238 168
239 buildTests( 169 buildTests(
240 'testCommentSnippets031', 170 'testCommentSnippets031',
241 ''' 171 '''
242 class Bar<T extends Foo> {m(x){if (x is !1) return;if (x is!!!2)}}''', 172 class Bar<T extends Foo> {m(x){if (x is !1) return;if (x is!!!2)}}''',
243 <String>["1+Bar", "1+T", "2+T", "2+Bar"], 173 <String>["1+Bar", "1+T", "2+T", "2+Bar"],
244 failingTests: '12'); 174 failingTests: '12');
245 175
246 buildTests( 176 buildTests(
247 'testCommentSnippets032', 177 'testCommentSnippets032',
248 ''' 178 '''
249 class Fit{}class Bar<T extends Fooa> {const !2F!1ara();}''', 179 class Fit{}class Bar<T extends Fooa> {const !2F!1ara();}''',
250 <String>["1+Fit", "1+Fara", "1-Bar", "2+Fit"], 180 <String>["1+Fit", "1+Fara", "1-Bar", "2+Fit"],
251 failingTests: '1'); 181 failingTests: '1');
252 182
253 // Type propagation 183 // Type propagation
254 buildTests( 184 buildTests('testCommentSnippets033', '''
255 'testCommentSnippets033',
256 '''
257 class List{add(){}length(){}}t1() {var x;if (x is List) {x.!1add(3);}}''', 185 class List{add(){}length(){}}t1() {var x;if (x is List) {x.!1add(3);}}''',
258 <String>["1+add", "1+length"]); 186 <String>["1+add", "1+length"]);
259 187
260 // Type propagation 188 // Type propagation
261 buildTests( 189 buildTests('testCommentSnippets035', '''
262 'testCommentSnippets035',
263 '''
264 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear( );}''', 190 class List{clear(){}length(){}}t3() {var x=new List(), y=x.!1length();x.!2clear( );}''',
265 <String>["1+length", "2+clear"]); 191 <String>["1+length", "2+clear"]);
266 192
267 buildTests( 193 buildTests('testCommentSnippets036', '''
268 'testCommentSnippets036', 194 class List{}t3() {var x=new List!1}''', <String>["1+List"]);
269 '''
270 class List{}t3() {var x=new List!1}''',
271 <String>["1+List"]);
272 195
273 buildTests( 196 buildTests('testCommentSnippets037', '''
274 'testCommentSnippets037',
275 '''
276 class List{factory List.from(){}}t3() {var x=new List.!1}''', 197 class List{factory List.from(){}}t3() {var x=new List.!1}''',
277 <String>["1+from"]); 198 <String>["1+from"]);
278 199
279 buildTests( 200 buildTests('testCommentSnippets038', '''
280 'testCommentSnippets038', 201 f(){int xa; String s = '\$x!1';}''', <String>["1+xa"]);
281 '''
282 f(){int xa; String s = '\$x!1';}''',
283 <String>["1+xa"]);
284 202
285 buildTests( 203 buildTests('testCommentSnippets038a', '''
286 'testCommentSnippets038a', 204 int xa; String s = '\$x!1\'''', <String>["1+xa"]);
287 '''
288 int xa; String s = '\$x!1\'''',
289 <String>["1+xa"]);
290 205
291 buildTests( 206 buildTests('testCommentSnippets039', '''
292 'testCommentSnippets039', 207 f(){int xa; String s = '\$!1';}''', <String>["1+xa"]);
293 '''
294 f(){int xa; String s = '\$!1';}''',
295 <String>["1+xa"]);
296 208
297 buildTests( 209 buildTests('testCommentSnippets039a', '''
298 'testCommentSnippets039a', 210 int xa; String s = '\$!1\'''', <String>["1+xa"]);
299 '''
300 int xa; String s = '\$!1\'''',
301 <String>["1+xa"]);
302 211
303 buildTests( 212 buildTests('testCommentSnippets040', '''
304 'testCommentSnippets040',
305 '''
306 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''', 213 class List{add(){}}class Map{}class X{m(){List list; list.!1 Map map;}}''',
307 <String>["1+add"]); 214 <String>["1+add"]);
308 215
309 buildTests( 216 buildTests('testCommentSnippets041', '''
310 'testCommentSnippets041',
311 '''
312 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''', 217 class List{add(){}length(){}}class X{m(){List list; list.!1 zox();}}''',
313 <String>["1+add"]); 218 <String>["1+add"]);
314 219
315 buildTests( 220 buildTests('testCommentSnippets042', '''
316 'testCommentSnippets042',
317 '''
318 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime. now();d.!1WED!2;}''', 221 class DateTime{static const int WED=3;int get day;}fd(){DateTime d=new DateTime. now();d.!1WED!2;}''',
319 <String>["1+day", "2-WED"]); 222 <String>["1+day", "2-WED"]);
320 223
321 buildTests( 224 buildTests('testCommentSnippets043', '''
322 'testCommentSnippets043', 225 class L{var k;void.!1}''', <String>["1-k"]);
323 '''
324 class L{var k;void.!1}''',
325 <String>["1-k"]);
326 226
327 buildTests( 227 buildTests('testCommentSnippets044', '''
328 'testCommentSnippets044',
329 '''
330 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', 228 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''',
331 <String>["1+List", "1+XXX.fisk"]); 229 <String>["1+List", "1+XXX.fisk"]);
332 230
333 buildTests( 231 buildTests('testCommentSnippets047', '''
334 'testCommentSnippets047', 232 f(){int x;int y=!1;}''', <String>["1+x"]);
335 '''
336 f(){int x;int y=!1;}''',
337 <String>["1+x"]);
338 233
339 buildTests( 234 buildTests('testCommentSnippets048', '''
340 'testCommentSnippets048', 235 import 'dart:convert' as json;f() {var x=new js!1}''', <String>["1+json"]);
341 '''
342 import 'dart:convert' as json;f() {var x=new js!1}''',
343 <String>["1+json"]);
344 236
345 buildTests( 237 buildTests('testCommentSnippets049', '''
346 'testCommentSnippets049',
347 '''
348 import 'dart:convert' as json; 238 import 'dart:convert' as json;
349 import 'dart:convert' as jxx; 239 import 'dart:convert' as jxx;
350 class JsonDecoderX{} 240 class JsonDecoderX{}
351 f1() {var x=new !2j!1s!3}''', 241 f1() {var x=new !2j!1s!3}''', <String>[
352 <String>[ 242 "1+json",
353 "1+json", 243 "1+jxx",
354 "1+jxx", 244 "2+json",
355 "2+json", 245 "2+jxx",
356 "2+jxx", 246 "2-JsonDecoder",
357 "2-JsonDecoder", 247 "3+json",
358 "3+json", 248 "3-jxx"
359 "3-jxx" 249 ]);
360 ]);
361 250
362 buildTests( 251 buildTests('testCommentSnippets050', '''
363 'testCommentSnippets050',
364 '''
365 class xdr { 252 class xdr {
366 xdr(); 253 xdr();
367 const xdr.a(a,b,c); 254 const xdr.a(a,b,c);
368 xdr.b(); 255 xdr.b();
369 f() => 3; 256 f() => 3;
370 } 257 }
371 class xa{} 258 class xa{}
372 k() { 259 k() {
373 new x!1dr().f(); 260 new x!1dr().f();
374 const x!2dr.!3a(1, 2, 3); 261 const x!2dr.!3a(1, 2, 3);
375 }''', 262 }''', <String>[
376 <String>[ 263 "1+xdr",
377 "1+xdr", 264 "1+xa",
378 "1+xa", 265 "1+xdr.a",
379 "1+xdr.a", 266 "1+xdr.b",
380 "1+xdr.b", 267 "2+xa", // suggest default constructor
381 "2+xa", // suggest default constructor 268 "2+xdr", // suggest normal constructor
382 "2+xdr", // suggest normal constructor 269 "2+xdr.a",
383 "2+xdr.a", 270 "2+xdr.b", // suggest named constructor
384 "2+xdr.b", // suggest named constructor 271 "3+b", // suggest named constructor
385 "3+b", // suggest named constructor 272 "3+a"
386 "3+a" 273 ]);
387 ]);
388 274
389 // Type propagation. 275 // Type propagation.
390 buildTests( 276 buildTests('testCommentSnippets051', '''
391 'testCommentSnippets051',
392 '''
393 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 277 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
394 void r() { 278 void r() {
395 var v; 279 var v;
396 if (v is String) { 280 if (v is String) {
397 v.!1length; 281 v.!1length;
398 v.!2getKeys; 282 v.!2getKeys;
399 } 283 }
400 }''', 284 }''', <String>["1+length", "2-getKeys"]);
401 <String>["1+length", "2-getKeys"]);
402 285
403 // Type propagation. 286 // Type propagation.
404 buildTests( 287 buildTests('testCommentSnippets052', '''
405 'testCommentSnippets052',
406 '''
407 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 288 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
408 void r() { 289 void r() {
409 List<String> values = ['a','b','c']; 290 List<String> values = ['a','b','c'];
410 for (var v in values) { 291 for (var v in values) {
411 v.!1toUpperCase; 292 v.!1toUpperCase;
412 v.!2getKeys; 293 v.!2getKeys;
413 } 294 }
414 }''', 295 }''', <String>["1+toUpperCase", "2-getKeys"]);
415 <String>["1+toUpperCase", "2-getKeys"]);
416 296
417 // Type propagation. 297 // Type propagation.
418 buildTests( 298 buildTests('testCommentSnippets053', '''
419 'testCommentSnippets053',
420 '''
421 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 299 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
422 void r() { 300 void r() {
423 var v; 301 var v;
424 while (v is String) { 302 while (v is String) {
425 v.!1toUpperCase; 303 v.!1toUpperCase;
426 v.!2getKeys; 304 v.!2getKeys;
427 } 305 }
428 }''', 306 }''', <String>["1+toUpperCase", "2-getKeys"]);
429 <String>["1+toUpperCase", "2-getKeys"]);
430 307
431 buildTests( 308 buildTests('testCommentSnippets054', '''
432 'testCommentSnippets054',
433 '''
434 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 309 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
435 void r() { 310 void r() {
436 var v; 311 var v;
437 for (; v is String; v.!1isEmpty) { 312 for (; v is String; v.!1isEmpty) {
438 v.!2toUpperCase; 313 v.!2toUpperCase;
439 v.!3getKeys; 314 v.!3getKeys;
440 } 315 }
441 }''', 316 }''', <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"]);
442 <String>["1+isEmpty", "2+toUpperCase", "3-getKeys"]);
443 317
444 buildTests( 318 buildTests('testCommentSnippets055', '''
445 'testCommentSnippets055',
446 '''
447 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 319 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
448 void r() { 320 void r() {
449 String v; 321 String v;
450 if (v is Object) { 322 if (v is Object) {
451 v.!1toUpperCase; 323 v.!1toUpperCase;
452 } 324 }
453 }''', 325 }''', <String>["1+toUpperCase"]);
454 <String>["1+toUpperCase"]);
455 326
456 // Type propagation. 327 // Type propagation.
457 buildTests( 328 buildTests('testCommentSnippets056', '''
458 'testCommentSnippets056',
459 '''
460 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 329 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
461 void f(var v) { 330 void f(var v) {
462 if (v is!! String) { 331 if (v is!! String) {
463 return; 332 return;
464 } 333 }
465 v.!1toUpperCase; 334 v.!1toUpperCase;
466 }''', 335 }''', <String>["1+toUpperCase"]);
467 <String>["1+toUpperCase"]);
468 336
469 // Type propagation. 337 // Type propagation.
470 buildTests( 338 buildTests('testCommentSnippets057', '''
471 'testCommentSnippets057',
472 '''
473 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 339 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
474 void f(var v) { 340 void f(var v) {
475 if ((v as String).!2length == 0) { 341 if ((v as String).!2length == 0) {
476 v.!1toUpperCase; 342 v.!1toUpperCase;
477 } 343 }
478 }''', 344 }''', <String>["1+toUpperCase", "2+length"]);
479 <String>["1+toUpperCase", "2+length"]);
480 345
481 buildTests( 346 buildTests(
482 'testCommentSnippets058', 347 'testCommentSnippets058',
483 ''' 348 '''
484 typedef vo!2id callback(int k); 349 typedef vo!2id callback(int k);
485 void x(callback q){} 350 void x(callback q){}
486 void r() { 351 void r() {
487 callback v; 352 callback v;
488 x(!1); 353 x(!1);
489 }''', 354 }''',
490 <String>["1+v", "2+void"], 355 <String>["1+v", "2+void"],
491 failingTests: '2'); 356 failingTests: '2');
492 357
493 buildTests( 358 buildTests('testCommentSnippets059', '''
494 'testCommentSnippets059', 359 f(){((int x) => x+4).!1call(1);}''', <String>["1-call"]);
495 '''
496 f(){((int x) => x+4).!1call(1);}''',
497 <String>["1-call"]);
498 360
499 buildTests( 361 buildTests('testCommentSnippets060', '''
500 'testCommentSnippets060',
501 '''
502 class Map{} 362 class Map{}
503 abstract class MM extends Map{factory MM() => new Map();} 363 abstract class MM extends Map{factory MM() => new Map();}
504 class Z { 364 class Z {
505 MM x; 365 MM x;
506 f() { 366 f() {
507 x!1 367 x!1
508 } 368 }
509 }''', 369 }''', <String>["1+x", "1-x[]"]);
510 <String>["1+x", "1-x[]"]);
511 370
512 buildTests( 371 buildTests('testCommentSnippets061', '''
513 'testCommentSnippets061',
514 '''
515 class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''', 372 class A{m(){!1f(3);!2}}n(){!3f(3);!4}f(x)=>x*3;''',
516 <String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]); 373 <String>["1+f", "1+n", "2+f", "2+n", "3+f", "3+n", "4+f", "4+n"]);
517 374
518 // Type propagation. 375 // Type propagation.
519 buildTests( 376 buildTests('testCommentSnippets063', '''
520 'testCommentSnippets063',
521 '''
522 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 377 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
523 void r(var v) { 378 void r(var v) {
524 v.!1toUpperCase; 379 v.!1toUpperCase;
525 assert(v is String); 380 assert(v is String);
526 v.!2toUpperCase; 381 v.!2toUpperCase;
527 }''', 382 }''', <String>["1-toUpperCase", "2+toUpperCase"]);
528 <String>["1-toUpperCase", "2+toUpperCase"]);
529 383
530 buildTests( 384 buildTests('testCommentSnippets064', '''
531 'testCommentSnippets064',
532 '''
533 class Spline { 385 class Spline {
534 Line c; 386 Line c;
535 Spline a() { 387 Spline a() {
536 return this; 388 return this;
537 } 389 }
538 Line b() { 390 Line b() {
539 return null; 391 return null;
540 } 392 }
541 Spline f() { 393 Spline f() {
542 Line x = new Line(); 394 Line x = new Line();
543 x.!9h()..!1a()..!2b().!7g(); 395 x.!9h()..!1a()..!2b().!7g();
544 x.!8j..!3b()..!4c..!6c..!5a(); 396 x.!8j..!3b()..!4c..!6c..!5a();
545 } 397 }
546 } 398 }
547 class Line { 399 class Line {
548 Spline j; 400 Spline j;
549 Line g() { 401 Line g() {
550 return this; 402 return this;
551 } 403 }
552 Spline h() { 404 Spline h() {
553 return null; 405 return null;
554 } 406 }
555 }''', 407 }''', <String>[
556 <String>[ 408 "1+a",
557 "1+a", 409 "2+b",
558 "2+b", 410 "1-g",
559 "1-g", 411 "2-h",
560 "2-h", 412 "3+b",
561 "3+b", 413 "4+c",
562 "4+c", 414 "5+a",
563 "5+a", 415 "6+c",
564 "6+c", 416 "7+g",
565 "7+g", 417 "8+j",
566 "8+j", 418 "9+h"
567 "9+h" 419 ]);
568 ]);
569 420
570 buildTests( 421 buildTests('testCommentSnippets065', '''
571 'testCommentSnippets065',
572 '''
573 class Spline { 422 class Spline {
574 Line c; 423 Line c;
575 Spline a() { 424 Spline a() {
576 return this; 425 return this;
577 } 426 }
578 Line b() { 427 Line b() {
579 return null; 428 return null;
580 } 429 }
581 Spline f() { 430 Spline f() {
582 Line x = new Line(); 431 Line x = new Line();
583 x.h()..!1; 432 x.h()..!1;
584 } 433 }
585 } 434 }
586 class Line { 435 class Line {
587 Spline j; 436 Spline j;
588 Line g() { 437 Line g() {
589 return this; 438 return this;
590 } 439 }
591 Spline h() { 440 Spline h() {
592 return null; 441 return null;
593 } 442 }
594 }''', 443 }''', <String>["1+a"]);
595 <String>["1+a"]);
596 444
597 buildTests( 445 buildTests('testCommentSnippets066', '''
598 'testCommentSnippets066',
599 '''
600 class Spline { 446 class Spline {
601 Line c; 447 Line c;
602 Spline a() { 448 Spline a() {
603 return this; 449 return this;
604 } 450 }
605 Line b() { 451 Line b() {
606 return null; 452 return null;
607 } 453 }
608 Spline f() { 454 Spline f() {
609 Line x = new Line(); 455 Line x = new Line();
610 x.h()..a()..!1; 456 x.h()..a()..!1;
611 } 457 }
612 } 458 }
613 class Line { 459 class Line {
614 Spline j; 460 Spline j;
615 Line g() { 461 Line g() {
616 return this; 462 return this;
617 } 463 }
618 Spline h() { 464 Spline h() {
619 return null; 465 return null;
620 } 466 }
621 }''', 467 }''', <String>["1+b"]);
622 <String>["1+b"]);
623 468
624 buildTests( 469 buildTests('testCommentSnippets067', '''
625 'testCommentSnippets067',
626 '''
627 class Spline { 470 class Spline {
628 Line c; 471 Line c;
629 Spline a() { 472 Spline a() {
630 return this; 473 return this;
631 } 474 }
632 Line b() { 475 Line b() {
633 return null; 476 return null;
634 } 477 }
635 Spline f() { 478 Spline f() {
636 Line x = new Line(); 479 Line x = new Line();
637 x.h()..a()..c..!1; 480 x.h()..a()..c..!1;
638 } 481 }
639 } 482 }
640 class Line { 483 class Line {
641 Spline j; 484 Spline j;
642 Line g() { 485 Line g() {
643 return this; 486 return this;
644 } 487 }
645 Spline h() { 488 Spline h() {
646 return null; 489 return null;
647 } 490 }
648 }''', 491 }''', <String>["1+b"]);
649 <String>["1+b"]);
650 492
651 buildTests( 493 buildTests('testCommentSnippets068', '''
652 'testCommentSnippets068',
653 '''
654 class Spline { 494 class Spline {
655 Line c; 495 Line c;
656 Spline a() { 496 Spline a() {
657 return this; 497 return this;
658 } 498 }
659 Line b() { 499 Line b() {
660 return null; 500 return null;
661 } 501 }
662 Spline f() { 502 Spline f() {
663 Line x = new Line(); 503 Line x = new Line();
664 x.j..b()..c..!1; 504 x.j..b()..c..!1;
665 } 505 }
666 } 506 }
667 class Line { 507 class Line {
668 Spline j; 508 Spline j;
669 Line g() { 509 Line g() {
670 return this; 510 return this;
671 } 511 }
672 Spline h() { 512 Spline h() {
673 return null; 513 return null;
674 } 514 }
675 }''', 515 }''', <String>["1+c"]);
676 <String>["1+c"]);
677 516
678 buildTests( 517 buildTests('testCommentSnippets069', '''
679 'testCommentSnippets069',
680 '''
681 class Spline { 518 class Spline {
682 Line c; 519 Line c;
683 Spline a() { 520 Spline a() {
684 return this; 521 return this;
685 } 522 }
686 Line b() { 523 Line b() {
687 return null; 524 return null;
688 } 525 }
689 Spline f() { 526 Spline f() {
690 Line x = new Line(); 527 Line x = new Line();
691 x.j..b()..!1; 528 x.j..b()..!1;
692 } 529 }
693 } 530 }
694 class Line { 531 class Line {
695 Spline j; 532 Spline j;
696 Line g() { 533 Line g() {
697 return this; 534 return this;
698 } 535 }
699 Spline h() { 536 Spline h() {
700 return null; 537 return null;
701 } 538 }
702 }''', 539 }''', <String>["1+c"]);
703 <String>["1+c"]);
704 540
705 buildTests( 541 buildTests('testCommentSnippets070', '''
706 'testCommentSnippets070',
707 '''
708 class Spline { 542 class Spline {
709 Line c; 543 Line c;
710 Spline a() { 544 Spline a() {
711 return this; 545 return this;
712 } 546 }
713 Line b() { 547 Line b() {
714 return null; 548 return null;
715 } 549 }
716 Spline f() { 550 Spline f() {
717 Line x = new Line(); 551 Line x = new Line();
718 x.j..!1; 552 x.j..!1;
719 } 553 }
720 } 554 }
721 class Line { 555 class Line {
722 Spline j; 556 Spline j;
723 Line g() { 557 Line g() {
724 return this; 558 return this;
725 } 559 }
726 Spline h() { 560 Spline h() {
727 return null; 561 return null;
728 } 562 }
729 }''', 563 }''', <String>["1+b"]);
730 <String>["1+b"]);
731 564
732 buildTests( 565 buildTests('testCommentSnippets072', '''
733 'testCommentSnippets072',
734 '''
735 class X { 566 class X {
736 int _p; 567 int _p;
737 set p(int x) => _p = x; 568 set p(int x) => _p = x;
738 } 569 }
739 f() { 570 f() {
740 X x = new X(); 571 X x = new X();
741 x.!1p = 3; 572 x.!1p = 3;
742 }''', 573 }''', <String>["1+p"]);
743 <String>["1+p"]);
744 574
745 buildTests( 575 buildTests('testCommentSnippets073', '''
746 'testCommentSnippets073',
747 '''
748 class X { 576 class X {
749 m() { 577 m() {
750 JSON.stri!1; 578 JSON.stri!1;
751 X f = null; 579 X f = null;
752 } 580 }
753 } 581 }
754 class JSON { 582 class JSON {
755 static stringify() {} 583 static stringify() {}
756 }''', 584 }''', <String>["1+stringify"]);
757 <String>["1+stringify"]);
758 585
759 buildTests( 586 buildTests('testCommentSnippets074', '''
760 'testCommentSnippets074',
761 '''
762 class X { 587 class X {
763 m() { 588 m() {
764 _x!1 589 _x!1
765 } 590 }
766 _x1(){} 591 _x1(){}
767 }''', 592 }''', <String>["1+_x1"]);
768 <String>["1+_x1"]);
769 593
770 buildTests( 594 buildTests('testCommentSnippets075', '''
771 'testCommentSnippets075', 595 p(x)=>0;var E;f(q)=>!1p(!2E);''', <String>["1+p", "2+E"]);
772 '''
773 p(x)=>0;var E;f(q)=>!1p(!2E);''',
774 <String>["1+p", "2+E"]);
775 596
776 buildTests( 597 buildTests('testCommentSnippets076', '''
777 'testCommentSnippets076',
778 '''
779 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i n!2t>>,List<!3int>>();}''', 598 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i n!2t>>,List<!3int>>();}''',
780 <String>["1+List", "2+int", "3+int"]); 599 <String>["1+List", "2+int", "3+int"]);
781 600
782 buildTests( 601 buildTests('testCommentSnippets076a', '''
783 'testCommentSnippets076a',
784 '''
785 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i n!2t>>,List<!3>>();}''', 602 class Map<K,V>{}class List<E>{}class int{}main() {var m=new Map<Lis!1t<Map<int,i n!2t>>,List<!3>>();}''',
786 <String>["1+List", "2+int", "3+int"]); 603 <String>["1+List", "2+int", "3+int"]);
787 604
788 buildTests( 605 buildTests('testCommentSnippets077', '''
789 'testCommentSnippets077',
790 '''
791 class FileMode { 606 class FileMode {
792 static const READ = const FileMode._internal(0); 607 static const READ = const FileMode._internal(0);
793 static const WRITE = const FileMode._internal(1); 608 static const WRITE = const FileMode._internal(1);
794 static const APPEND = const FileMode._internal(2); 609 static const APPEND = const FileMode._internal(2);
795 const FileMode._internal(int this._mode); 610 const FileMode._internal(int this._mode);
796 factory FileMode._internal1(int this._mode); 611 factory FileMode._internal1(int this._mode);
797 factory FileMode(_mode); 612 factory FileMode(_mode);
798 final int _mode; 613 final int _mode;
799 } 614 }
800 class File { 615 class File {
801 factory File(String path) => null; 616 factory File(String path) => null;
802 factory File.fromPath(Path path) => null; 617 factory File.fromPath(Path path) => null;
803 } 618 }
804 f() => new Fil!1''', 619 f() => new Fil!1''', <String>[
805 <String>[ 620 "1+File",
806 "1+File", 621 "1+File.fromPath",
807 "1+File.fromPath", 622 "1+FileMode",
808 "1+FileMode", 623 "1+FileMode._internal1",
809 "1+FileMode._internal1", 624 "1+FileMode._internal"
810 "1+FileMode._internal" 625 ]);
811 ]);
812 626
813 buildTests( 627 buildTests('testCommentSnippets078', '''
814 'testCommentSnippets078',
815 '''
816 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''', 628 class Map{static from()=>null;clear(){}}void main() { Map.!1 }''',
817 <String>["1+from", "1-clear"]); // static method, instance method 629 <String>["1+from", "1-clear"]); // static method, instance method
818 630
819 buildTests( 631 buildTests('testCommentSnippets079', '''
820 'testCommentSnippets079',
821 '''
822 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''', 632 class Map{static from()=>null;clear(){}}void main() { Map s; s.!1 }''',
823 <String>["1-from", "1+clear"]); // static method, instance method 633 <String>["1-from", "1+clear"]); // static method, instance method
824 634
825 buildTests( 635 buildTests('testCommentSnippets080', '''
826 'testCommentSnippets080',
827 '''
828 class RuntimeError{var message;}void main() { RuntimeError.!1 }''', 636 class RuntimeError{var message;}void main() { RuntimeError.!1 }''',
829 <String>["1-message"]); // field 637 <String>["1-message"]); // field
830 638
831 buildTests( 639 buildTests(
832 'testCommentSnippets081', 640 'testCommentSnippets081',
833 ''' 641 '''
834 class Foo {this.!1}''', 642 class Foo {this.!1}''',
835 <String>["1-Object"], 643 <String>["1-Object"],
836 failingTests: '1'); 644 failingTests: '1');
837 645
838 buildTests( 646 buildTests('testCommentSnippets082', '''
839 'testCommentSnippets082',
840 '''
841 class HttpRequest {} 647 class HttpRequest {}
842 class HttpResponse {} 648 class HttpResponse {}
843 main() { 649 main() {
844 var v = (HttpRequest req, HttpResp!1) 650 var v = (HttpRequest req, HttpResp!1)
845 }''', 651 }''', <String>["1+HttpResponse"]);
846 <String>["1+HttpResponse"]);
847 652
848 buildTests( 653 buildTests('testCommentSnippets083', '''
849 'testCommentSnippets083', 654 main() {(.!1)}''', <String>["1-toString"]);
850 '''
851 main() {(.!1)}''',
852 <String>["1-toString"]);
853 655
854 buildTests( 656 buildTests('testCommentSnippets083a', '''
855 'testCommentSnippets083a', 657 main() { .!1 }''', <String>["1-toString"]);
856 '''
857 main() { .!1 }''',
858 <String>["1-toString"]);
859 658
860 buildTests( 659 buildTests('testCommentSnippets083b', '''
861 'testCommentSnippets083b', 660 main() { null.!1 }''', <String>["1+toString"]);
862 '''
863 main() { null.!1 }''',
864 <String>["1+toString"]);
865 661
866 buildTests( 662 buildTests('testCommentSnippets085', '''
867 'testCommentSnippets085',
868 '''
869 class List{}class Map{}class Z extends List with !1Ma!2p {}''', 663 class List{}class Map{}class Z extends List with !1Ma!2p {}''',
870 <String>["1+List", "1+Map", "2+Map", "2-List"]); 664 <String>["1+List", "1+Map", "2+Map", "2-List"]);
871 665
872 buildTests( 666 buildTests(
873 'testCommentSnippets086', 667 'testCommentSnippets086',
874 ''' 668 '''
875 class Q{f(){xy() {!2};x!1y();}}''', 669 class Q{f(){xy() {!2};x!1y();}}''',
876 <String>["1+xy", "2+f", "2-xy"], 670 <String>["1+xy", "2+f", "2-xy"],
877 failingTests: '2'); 671 failingTests: '2');
878 672
879 buildTests( 673 buildTests('testCommentSnippets087', '''
880 'testCommentSnippets087',
881 '''
882 class Map{}class Q extends Object with !1Map {}''', 674 class Map{}class Q extends Object with !1Map {}''',
883 <String>["1+Map", "1-HashMap"]); 675 <String>["1+Map", "1-HashMap"]);
884 676
885 buildTests( 677 buildTests('testCommentSnippets088', '''
886 'testCommentSnippets088',
887 '''
888 class A { 678 class A {
889 int f; 679 int f;
890 B m(){} 680 B m(){}
891 } 681 }
892 class B extends A { 682 class B extends A {
893 num f; 683 num f;
894 A m(){} 684 A m(){}
895 } 685 }
896 class Z { 686 class Z {
897 B q; 687 B q;
898 f() {q.!1} 688 f() {q.!1}
899 }''', 689 }''', <String>["1+f", "1+m"]); // f->num, m()->A
900 <String>["1+f", "1+m"]); // f->num, m()->A
901 690
902 buildTests( 691 buildTests(
903 'testCommentSnippets089', 692 'testCommentSnippets089',
904 ''' 693 '''
905 class Q { 694 class Q {
906 fqe() { 695 fqe() {
907 xya() { 696 xya() {
908 xyb() { 697 xyb() {
909 !1 698 !1
910 } 699 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
947 "4+xza", 736 "4+xza",
948 "5+fqe", 737 "5+fqe",
949 "5+fqi", 738 "5+fqi",
950 "5+Q", 739 "5+Q",
951 "5-xya", 740 "5-xya",
952 "5-xyb", 741 "5-xyb",
953 "5-xza" 742 "5-xza"
954 ], 743 ],
955 failingTests: '123'); 744 failingTests: '123');
956 745
957 buildTests( 746 buildTests('testCommentSnippets090', '''
958 'testCommentSnippets090', 747 class X { f() { var a = 'x'; a.!1 }}''', <String>["1+length"]);
959 '''
960 class X { f() { var a = 'x'; a.!1 }}''',
961 <String>["1+length"]);
962 } 748 }
963 749
964 void buildCompletionTests() { 750 void buildCompletionTests() {
965 buildTests( 751 buildTests('testCompletion_alias_field', '''
966 'testCompletion_alias_field', 752 typedef int fnint(int k); fn!1int x;''', <String>["1+fnint"]);
967 '''
968 typedef int fnint(int k); fn!1int x;''',
969 <String>["1+fnint"]);
970 753
971 buildTests( 754 buildTests(
972 'testCompletion_annotation_argumentList', 755 'testCompletion_annotation_argumentList',
973 ''' 756 '''
974 class AAA {", 757 class AAA {",
975 const AAA({int aaa, int bbb});", 758 const AAA({int aaa, int bbb});",
976 }", 759 }",
977 ", 760 ",
978 @AAA(!1) 761 @AAA(!1)
979 main() { 762 main() {
(...skipping 27 matching lines...) Expand all
1007 } 790 }
1008 @AAA!1 791 @AAA!1
1009 main() { 792 main() {
1010 }''', 793 }''',
1011 <String>[ 794 <String>[
1012 "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/, 795 "1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/,
1013 "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/ 796 "1+AAA.nnn" /*":" + ProposalKind.CONSTRUCTOR*/
1014 ], 797 ],
1015 failingTests: '1'); 798 failingTests: '1');
1016 799
1017 buildTests( 800 buildTests('testCompletion_annotation_type_inClass_withoutMember', '''
1018 'testCompletion_annotation_type_inClass_withoutMember',
1019 '''
1020 class AAA { 801 class AAA {
1021 const AAA(); 802 const AAA();
1022 } 803 }
1023 804
1024 class C { 805 class C {
1025 @A!1 806 @A!1
1026 }''', 807 }''', <String>["1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/]);
1027 <String>["1+AAA" /*":" + ProposalKind.CONSTRUCTOR*/]);
1028 808
1029 buildTests( 809 buildTests('testCompletion_argument_typeName', '''
1030 'testCompletion_argument_typeName',
1031 '''
1032 class Enum { 810 class Enum {
1033 static Enum FOO = new Enum(); 811 static Enum FOO = new Enum();
1034 } 812 }
1035 f(Enum e) {} 813 f(Enum e) {}
1036 main() { 814 main() {
1037 f(En!1); 815 f(En!1);
1038 }''', 816 }''', <String>["1+Enum"]);
1039 <String>["1+Enum"]);
1040 817
1041 buildTests( 818 buildTests('testCompletion_arguments_ignoreEmpty', '''
1042 'testCompletion_arguments_ignoreEmpty',
1043 '''
1044 class A { 819 class A {
1045 test() {} 820 test() {}
1046 } 821 }
1047 main(A a) { 822 main(A a) {
1048 a.test(!1); 823 a.test(!1);
1049 }''', 824 }''', <String>["1-test"]);
1050 <String>["1-test"]);
1051 825
1052 buildTests( 826 buildTests('testCompletion_as_asIdentifierPrefix', '''
1053 'testCompletion_as_asIdentifierPrefix',
1054 '''
1055 main(p) { 827 main(p) {
1056 var asVisible; 828 var asVisible;
1057 var v = as!1; 829 var v = as!1;
1058 }''', 830 }''', <String>["1+asVisible"]);
1059 <String>["1+asVisible"]);
1060 831
1061 buildTests( 832 buildTests('testCompletion_as_asPrefixedIdentifierStart', '''
1062 'testCompletion_as_asPrefixedIdentifierStart',
1063 '''
1064 class A { 833 class A {
1065 var asVisible; 834 var asVisible;
1066 } 835 }
1067 836
1068 main(A p) { 837 main(A p) {
1069 var v = p.as!1; 838 var v = p.as!1;
1070 }''', 839 }''', <String>["1+asVisible"]);
1071 <String>["1+asVisible"]);
1072 840
1073 buildTests( 841 buildTests('testCompletion_as_incompleteStatement', '''
1074 'testCompletion_as_incompleteStatement',
1075 '''
1076 class MyClass {} 842 class MyClass {}
1077 main(p) { 843 main(p) {
1078 var justSomeVar; 844 var justSomeVar;
1079 var v = p as !1 845 var v = p as !1
1080 }''', 846 }''', <String>["1+MyClass", "1-justSomeVar"]);
1081 <String>["1+MyClass", "1-justSomeVar"]);
1082 847
1083 buildTests( 848 buildTests('testCompletion_cascade', '''
1084 'testCompletion_cascade',
1085 '''
1086 class A { 849 class A {
1087 aaa() {} 850 aaa() {}
1088 } 851 }
1089 852
1090 853
1091 main(A a) { 854 main(A a) {
1092 a..!1 aaa(); 855 a..!1 aaa();
1093 }''', 856 }''', <String>["1+aaa", "1-main"]);
1094 <String>["1+aaa", "1-main"]);
1095 857
1096 buildTests( 858 buildTests('testCompletion_combinator_afterComma', '''
1097 'testCompletion_combinator_afterComma',
1098 '''
1099 import 'dart:math' show cos, !1;''', 859 import 'dart:math' show cos, !1;''',
1100 <String>["1+PI", "1+sin", "1+Random", "1-String"]); 860 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
1101 861
1102 buildTests( 862 buildTests('testCompletion_combinator_ended', '''
1103 'testCompletion_combinator_ended',
1104 '''
1105 import 'dart:math' show !1;"''', 863 import 'dart:math' show !1;"''',
1106 <String>["1+PI", "1+sin", "1+Random", "1-String"]); 864 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
1107 865
1108 buildTests( 866 buildTests('testCompletion_combinator_export', '''
1109 'testCompletion_combinator_export',
1110 '''
1111 export 'dart:math' show !1;"''', 867 export 'dart:math' show !1;"''',
1112 <String>["1+PI", "1+sin", "1+Random", "1-String"]); 868 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
1113 869
1114 buildTests( 870 buildTests('testCompletion_combinator_hide', '''
1115 'testCompletion_combinator_hide',
1116 '''
1117 import 'dart:math' hide !1;"''', 871 import 'dart:math' hide !1;"''',
1118 <String>["1+PI", "1+sin", "1+Random", "1-String"]); 872 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
1119 873
1120 buildTests( 874 buildTests('testCompletion_combinator_notEnded', '''
1121 'testCompletion_combinator_notEnded',
1122 '''
1123 import 'dart:math' show !1"''', 875 import 'dart:math' show !1"''',
1124 <String>["1+PI", "1+sin", "1+Random", "1-String"]); 876 <String>["1+PI", "1+sin", "1+Random", "1-String"]);
1125 877
1126 buildTests( 878 buildTests('testCompletion_combinator_usePrefix', '''
1127 'testCompletion_combinator_usePrefix',
1128 '''
1129 import 'dart:math' show s!1"''', 879 import 'dart:math' show s!1"''',
1130 <String>["1+sin", "1+sqrt", "1-cos", "1-String"]); 880 <String>["1+sin", "1+sqrt", "1-cos", "1-String"]);
1131 881
1132 buildTests( 882 buildTests(
1133 'testCompletion_constructor_field', 883 'testCompletion_constructor_field',
1134 ''' 884 '''
1135 class X { X(this.field); int f!1ield;}''', 885 class X { X(this.field); int f!1ield;}''',
1136 <String>["1+field"], 886 <String>["1+field"],
1137 failingTests: '1'); 887 failingTests: '1');
1138 888
(...skipping 13 matching lines...) Expand all
1152 buildTests( 902 buildTests(
1153 'testCompletion_constructorArguments_whenPrefixedType', 903 'testCompletion_constructorArguments_whenPrefixedType',
1154 ''' 904 '''
1155 import 'dart:math' as m; 905 import 'dart:math' as m;
1156 main() { 906 main() {
1157 new m.Random(!1); 907 new m.Random(!1);
1158 }''', 908 }''',
1159 <String>["1+Random:ARGUMENT_LIST"], 909 <String>["1+Random:ARGUMENT_LIST"],
1160 failingTests: '1'); 910 failingTests: '1');
1161 911
1162 buildTests( 912 buildTests('testCompletion_dartDoc_reference_forClass', '''
1163 'testCompletion_dartDoc_reference_forClass',
1164 '''
1165 /** 913 /**
1166 * [int!1] 914 * [int!1]
1167 * [method!2] 915 * [method!2]
1168 */ 916 */
1169 class AAA { 917 class AAA {
1170 methodA() {} 918 methodA() {}
1171 }''', 919 }''', <String>["1+int", "1-method", "2+methodA", "2-int"]);
1172 <String>["1+int", "1-method", "2+methodA", "2-int"]);
1173 920
1174 buildTests( 921 buildTests('testCompletion_dartDoc_reference_forConstructor', '''
1175 'testCompletion_dartDoc_reference_forConstructor',
1176 '''
1177 class A { 922 class A {
1178 /** 923 /**
1179 * [aa!1] 924 * [aa!1]
1180 * [int!2] 925 * [int!2]
1181 * [method!3] 926 * [method!3]
1182 */ 927 */
1183 A.named(aaa, bbb) {} 928 A.named(aaa, bbb) {}
1184 methodA() {} 929 methodA() {}
1185 }''', 930 }''', <String>["1+aaa", "1-bbb", "2+int", "2-double", "3+methodA"]);
1186 <String>["1+aaa", "1-bbb", "2+int", "2-double", "3+methodA"]);
1187 931
1188 buildTests( 932 buildTests(
1189 'testCompletion_dartDoc_reference_forFunction', 933 'testCompletion_dartDoc_reference_forFunction',
1190 ''' 934 '''
1191 /** 935 /**
1192 * [aa!1] 936 * [aa!1]
1193 * [int!2] 937 * [int!2]
1194 * [function!3] 938 * [function!3]
1195 */ 939 */
1196 functionA(aaa, bbb) {} 940 functionA(aaa, bbb) {}
(...skipping 23 matching lines...) Expand all
1220 "1+aaa", 964 "1+aaa",
1221 "1-bbb", 965 "1-bbb",
1222 "2+int", 966 "2+int",
1223 "2-double", 967 "2-double",
1224 "3+FunctionA", 968 "3+FunctionA",
1225 "3+FunctionB", 969 "3+FunctionB",
1226 "3-int" 970 "3-int"
1227 ], 971 ],
1228 failingTests: '1'); 972 failingTests: '1');
1229 973
1230 buildTests( 974 buildTests('testCompletion_dartDoc_reference_forMethod', '''
1231 'testCompletion_dartDoc_reference_forMethod',
1232 '''
1233 class A { 975 class A {
1234 /** 976 /**
1235 * [aa!1] 977 * [aa!1]
1236 * [int!2] 978 * [int!2]
1237 * [method!3] 979 * [method!3]
1238 */ 980 */
1239 methodA(aaa, bbb) {} 981 methodA(aaa, bbb) {}
1240 methodB() {} 982 methodB() {}
1241 }''', 983 }''', <String>[
1242 <String>[ 984 "1+aaa",
1243 "1+aaa", 985 "1-bbb",
1244 "1-bbb", 986 "2+int",
1245 "2+int", 987 "2-double",
1246 "2-double", 988 "3+methodA",
1247 "3+methodA", 989 "3+methodB",
1248 "3+methodB", 990 "3-int"
1249 "3-int" 991 ]);
1250 ]);
1251 992
1252 buildTests( 993 buildTests('testCompletion_dartDoc_reference_incomplete', '''
1253 'testCompletion_dartDoc_reference_incomplete',
1254 '''
1255 /** 994 /**
1256 * [doubl!1 some text 995 * [doubl!1 some text
1257 * other text 996 * other text
1258 */ 997 */
1259 class A {} 998 class A {}
1260 /** 999 /**
1261 * [!2 some text 1000 * [!2 some text
1262 * other text 1001 * other text
1263 */ 1002 */
1264 class B {} 1003 class B {}
1265 /** 1004 /**
1266 * [!3] some text 1005 * [!3] some text
1267 */ 1006 */
1268 class C {}''', 1007 class C {}''', <String>[
1269 <String>[ 1008 "1+double",
1270 "1+double", 1009 "1-int",
1271 "1-int", 1010 "2+int",
1272 "2+int", 1011 "2+String",
1273 "2+String", 1012 "3+int",
1274 "3+int", 1013 "3+String"
1275 "3+String" 1014 ]);
1276 ]);
1277 1015
1278 buildTests( 1016 buildTests('testCompletion_double_inFractionPart', '''
1279 'testCompletion_double_inFractionPart',
1280 '''
1281 main() { 1017 main() {
1282 1.0!1 1018 1.0!1
1283 }''', 1019 }''', <String>["1-abs", "1-main"]);
1284 <String>["1-abs", "1-main"]);
1285 1020
1286 buildTests( 1021 buildTests('testCompletion_enum', '''
1287 'testCompletion_enum',
1288 '''
1289 enum MyEnum {A, B, C} 1022 enum MyEnum {A, B, C}
1290 main() { 1023 main() {
1291 MyEnum.!1; 1024 MyEnum.!1;
1292 }''', 1025 }''', <String>["1+values", "1+A", "1+B", "1+C"]);
1293 <String>["1+values", "1+A", "1+B", "1+C"]);
1294 1026
1295 buildTests( 1027 buildTests('testCompletion_exactPrefix_hasHigherRelevance', '''
1296 'testCompletion_exactPrefix_hasHigherRelevance',
1297 '''
1298 var STR; 1028 var STR;
1299 main(p) { 1029 main(p) {
1300 var str; 1030 var str;
1301 str!1; 1031 str!1;
1302 STR!2; 1032 STR!2;
1303 Str!3; 1033 Str!3;
1304 }''', 1034 }''', <String>[
1305 <String>[ 1035 "1+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/,
1306 "1+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, 1036 "1+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/,
1307 "1+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, 1037 "2+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/,
1308 "2+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, 1038 "2+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/,
1309 "2+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, 1039 "3+String" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/,
1310 "3+String" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 1)*/, 1040 "3+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/,
1311 "3+STR" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/, 1041 "3+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/
1312 "3+str" /*",rel=" + (CompletionProposal.RELEVANCE_DEFAULT + 0)*/ 1042 ]);
1313 ]);
1314 1043
1315 buildTests( 1044 buildTests('testCompletion_export_dart', '''
1316 'testCompletion_export_dart',
1317 '''
1318 import 'dart:math 1045 import 'dart:math
1319 import 'dart:_chrome 1046 import 'dart:_chrome
1320 import 'dart:_collection.dev 1047 import 'dart:_collection.dev
1321 export 'dart:!1''', 1048 export 'dart:!1''', <String>[
1322 <String>[ 1049 "1+dart:core",
1323 "1+dart:core", 1050 "1+dart:math",
1324 "1+dart:math", 1051 "1-dart:_chrome",
1325 "1-dart:_chrome", 1052 "1-dart:_collection.dev"
1326 "1-dart:_collection.dev" 1053 ]);
1327 ]);
1328 1054
1329 buildTests( 1055 buildTests(
1330 'testCompletion_export_noStringLiteral_noSemicolon', 1056 'testCompletion_export_noStringLiteral_noSemicolon',
1331 ''' 1057 '''
1332 import !1 1058 import !1
1333 1059
1334 class A {}''', 1060 class A {}''',
1335 <String>["1+'dart:!';", "1+'package:!';"], 1061 <String>["1+'dart:!';", "1+'package:!';"],
1336 failingTests: '1'); 1062 failingTests: '1');
1337 1063
1338 buildTests( 1064 buildTests('testCompletion_forStmt_vars', '''
1339 'testCompletion_forStmt_vars',
1340 '''
1341 class int{}class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}''', 1065 class int{}class Foo { mth() { for (in!1t i = 0; i!2 < 5; i!3++); }}''',
1342 <String>["1+int", "2+i", "3+i"]); 1066 <String>["1+int", "2+i", "3+i"]);
1343 1067
1344 buildTests( 1068 buildTests('testCompletion_function', '''
1345 'testCompletion_function',
1346 '''
1347 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b)); }}''', 1069 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1) => a.compareTo(b)); }}''',
1348 <String>["1+String"]); 1070 <String>["1+String"]);
1349 1071
1350 buildTests( 1072 buildTests('testCompletion_function_partial', '''
1351 'testCompletion_function_partial',
1352 '''
1353 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}''', 1073 class Foo { int boo = 7; mth() { PNGS.sort((String a, Str!1)); }}''',
1354 <String>["1+String"]); 1074 <String>["1+String"]);
1355 1075
1356 buildTests( 1076 buildTests(
1357 'testCompletion_functionTypeParameter_namedArgument', 1077 'testCompletion_functionTypeParameter_namedArgument',
1358 ''' 1078 '''
1359 typedef FFF(a, b, {x1, x2, y}); 1079 typedef FFF(a, b, {x1, x2, y});
1360 main(FFF fff) { 1080 main(FFF fff) {
1361 fff(1, 2, !1)!2; 1081 fff(1, 2, !1)!2;
1362 }''', 1082 }''',
1363 <String>["1+x1", "2-x2"], 1083 <String>["1+x1", "2-x2"],
1364 failingTests: '1'); 1084 failingTests: '1');
1365 1085
1366 buildTests( 1086 buildTests('testCompletion_ifStmt_field1', '''
1367 'testCompletion_ifStmt_field1', 1087 class Foo { int myField = 7; mth() { if (!1) {}}}''', <String>["1+myField"]);
1368 '''
1369 class Foo { int myField = 7; mth() { if (!1) {}}}''',
1370 <String>["1+myField"]);
1371 1088
1372 buildTests( 1089 buildTests('testCompletion_ifStmt_field1a', '''
1373 'testCompletion_ifStmt_field1a', 1090 class Foo { int myField = 7; mth() { if (!1) }}''', <String>["1+myField"]);
1374 '''
1375 class Foo { int myField = 7; mth() { if (!1) }}''',
1376 <String>["1+myField"]);
1377 1091
1378 buildTests( 1092 buildTests('testCompletion_ifStmt_field2', '''
1379 'testCompletion_ifStmt_field2', 1093 class Foo { int myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]);
1380 '''
1381 class Foo { int myField = 7; mth() { if (m!1) {}}}''',
1382 <String>["1+myField"]);
1383 1094
1384 buildTests( 1095 buildTests('testCompletion_ifStmt_field2a', '''
1385 'testCompletion_ifStmt_field2a', 1096 class Foo { int myField = 7; mth() { if (m!1) }}''', <String>["1+myField"]);
1386 '''
1387 class Foo { int myField = 7; mth() { if (m!1) }}''',
1388 <String>["1+myField"]);
1389 1097
1390 buildTests( 1098 buildTests('testCompletion_ifStmt_field2b', '''
1391 'testCompletion_ifStmt_field2b', 1099 class Foo { myField = 7; mth() { if (m!1) {}}}''', <String>["1+myField"]);
1392 '''
1393 class Foo { myField = 7; mth() { if (m!1) {}}}''',
1394 <String>["1+myField"]);
1395 1100
1396 buildTests( 1101 buildTests('testCompletion_ifStmt_localVar', '''
1397 'testCompletion_ifStmt_localVar', 1102 class Foo { mth() { int value = 7; if (v!1) {}}}''', <String>["1+value"]);
1398 '''
1399 class Foo { mth() { int value = 7; if (v!1) {}}}''',
1400 <String>["1+value"]);
1401 1103
1402 buildTests( 1104 buildTests('testCompletion_ifStmt_localVara', '''
1403 'testCompletion_ifStmt_localVara', 1105 class Foo { mth() { value = 7; if (v!1) {}}}''', <String>["1-value"]);
1404 '''
1405 class Foo { mth() { value = 7; if (v!1) {}}}''',
1406 <String>["1-value"]);
1407 1106
1408 buildTests( 1107 buildTests('testCompletion_ifStmt_topLevelVar', '''
1409 'testCompletion_ifStmt_topLevelVar', 1108 int topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]);
1410 '''
1411 int topValue = 7; class Foo { mth() { if (t!1) {}}}''',
1412 <String>["1+topValue"]);
1413 1109
1414 buildTests( 1110 buildTests('testCompletion_ifStmt_topLevelVara', '''
1415 'testCompletion_ifStmt_topLevelVara', 1111 topValue = 7; class Foo { mth() { if (t!1) {}}}''', <String>["1+topValue"]);
1416 '''
1417 topValue = 7; class Foo { mth() { if (t!1) {}}}''',
1418 <String>["1+topValue"]);
1419 1112
1420 buildTests( 1113 buildTests(
1421 'testCompletion_ifStmt_unionType_nonStrict', 1114 'testCompletion_ifStmt_unionType_nonStrict',
1422 ''' 1115 '''
1423 class A { a() => null; x() => null} 1116 class A { a() => null; x() => null}
1424 class B { a() => null; y() => null} 1117 class B { a() => null; y() => null}
1425 void main() { 1118 void main() {
1426 var x; 1119 var x;
1427 var c; 1120 var c;
1428 if(c) { 1121 if(c) {
(...skipping 17 matching lines...) Expand all
1446 if(c) { 1139 if(c) {
1447 x = new A(); 1140 x = new A();
1448 } else { 1141 } else {
1449 x = new B(); 1142 x = new B();
1450 } 1143 }
1451 x.!1; 1144 x.!1;
1452 }''', 1145 }''',
1453 <String>["1+a", "1-x", "1-y"], 1146 <String>["1+a", "1-x", "1-y"],
1454 failingTests: '1'); 1147 failingTests: '1');
1455 1148
1456 buildTests( 1149 buildTests('testCompletion_import', '''
1457 'testCompletion_import', 1150 import '!1';''', <String>["1+dart:!", "1+package:!"]);
1458 '''
1459 import '!1';''',
1460 <String>["1+dart:!", "1+package:!"]);
1461 1151
1462 buildTests( 1152 buildTests('testCompletion_import_dart', '''
1463 'testCompletion_import_dart',
1464 '''
1465 import 'dart:math 1153 import 'dart:math
1466 import 'dart:_chrome 1154 import 'dart:_chrome
1467 import 'dart:_collection.dev 1155 import 'dart:_collection.dev
1468 import 'dart:!1''', 1156 import 'dart:!1''', <String>[
1469 <String>[ 1157 "1+dart:core",
1470 "1+dart:core", 1158 "1+dart:math",
1471 "1+dart:math", 1159 "1-dart:_chrome",
1472 "1-dart:_chrome", 1160 "1-dart:_collection.dev"
1473 "1-dart:_collection.dev" 1161 ]);
1474 ]);
1475 1162
1476 buildTests( 1163 buildTests('testCompletion_import_hasStringLiteral_noSemicolon', '''
1477 'testCompletion_import_hasStringLiteral_noSemicolon',
1478 '''
1479 import '!1' 1164 import '!1'
1480 1165
1481 class A {}''', 1166 class A {}''', <String>["1+dart:!", "1+package:!"]);
1482 <String>["1+dart:!", "1+package:!"]);
1483 1167
1484 buildTests( 1168 buildTests(
1485 'testCompletion_import_noSpace', 1169 'testCompletion_import_noSpace',
1486 ''' 1170 '''
1487 import!1''', 1171 import!1''',
1488 <String>["1+ 'dart:!';", "1+ 'package:!';"], 1172 <String>["1+ 'dart:!';", "1+ 'package:!';"],
1489 failingTests: '1'); 1173 failingTests: '1');
1490 1174
1491 buildTests( 1175 buildTests(
1492 'testCompletion_import_noStringLiteral', 1176 'testCompletion_import_noStringLiteral',
1493 ''' 1177 '''
1494 import !1;''', 1178 import !1;''',
1495 <String>["1+'dart:!'", "1+'package:!'"], 1179 <String>["1+'dart:!'", "1+'package:!'"],
1496 failingTests: '1'); 1180 failingTests: '1');
1497 1181
1498 buildTests( 1182 buildTests(
1499 'testCompletion_import_noStringLiteral_noSemicolon', 1183 'testCompletion_import_noStringLiteral_noSemicolon',
1500 ''' 1184 '''
1501 import !1 1185 import !1
1502 1186
1503 class A {}''', 1187 class A {}''',
1504 <String>["1+'dart:!';", "1+'package:!';"], 1188 <String>["1+'dart:!';", "1+'package:!';"],
1505 failingTests: '1'); 1189 failingTests: '1');
1506 1190
1507 buildTests( 1191 buildTests('testCompletion_incompleteClassMember', '''
1508 'testCompletion_incompleteClassMember',
1509 '''
1510 class A { 1192 class A {
1511 Str!1 1193 Str!1
1512 final f = null; 1194 final f = null;
1513 }''', 1195 }''', <String>["1+String", "1-bool"]);
1514 <String>["1+String", "1-bool"]);
1515 1196
1516 buildTests( 1197 buildTests('testCompletion_incompleteClosure_parameterType', '''
1517 'testCompletion_incompleteClosure_parameterType',
1518 '''
1519 f1(cb(String s)) {} 1198 f1(cb(String s)) {}
1520 f2(String s) {} 1199 f2(String s) {}
1521 main() { 1200 main() {
1522 f1((Str!1)); 1201 f1((Str!1));
1523 f2((Str!2)); 1202 f2((Str!2));
1524 }''', 1203 }''', <String>["1+String", "1-bool", "2+String", "2-bool"]);
1525 <String>["1+String", "1-bool", "2+String", "2-bool"]);
1526 1204
1527 buildTests( 1205 buildTests(
1528 'testCompletion_inPeriodPeriod', 1206 'testCompletion_inPeriodPeriod',
1529 ''' 1207 '''
1530 main(String str) { 1208 main(String str) {
1531 1 < str.!1.length; 1209 1 < str.!1.length;
1532 1 + str.!2.length; 1210 1 + str.!2.length;
1533 1 + 2 * str.!3.length; 1211 1 + 2 * str.!3.length;
1534 }''', 1212 }''',
1535 <String>["1+codeUnits", "2+codeUnits", "3+codeUnits"], 1213 <String>["1+codeUnits", "2+codeUnits", "3+codeUnits"],
1536 failingTests: '123'); 1214 failingTests: '123');
1537 1215
1538 // no checks, but no exceptions 1216 // no checks, but no exceptions
1539 buildTests( 1217 buildTests('testCompletion_instanceCreation_unresolved', '''
1540 'testCompletion_instanceCreation_unresolved',
1541 '''
1542 class A { 1218 class A {
1543 } 1219 }
1544 main() { 1220 main() {
1545 new NoSuchClass(!1); 1221 new NoSuchClass(!1);
1546 new A.noSuchConstructor(!2); 1222 new A.noSuchConstructor(!2);
1547 }''', 1223 }''', <String>["1+int", "2+int"]);
1548 <String>["1+int", "2+int"]);
1549 1224
1550 buildTests( 1225 buildTests(
1551 'testCompletion_import_lib', 1226 'testCompletion_import_lib',
1552 ''' 1227 '''
1553 import '!1''', 1228 import '!1''',
1554 <String>["1+my_lib.dart"], 1229 <String>["1+my_lib.dart"],
1555 extraFiles: <String, String>{"/my_lib.dart": ""}, 1230 extraFiles: <String, String>{"/my_lib.dart": ""},
1556 failingTests: '1'); 1231 failingTests: '1');
1557 1232
1558 buildTests( 1233 buildTests('testCompletion_is', '''
1559 'testCompletion_is',
1560 '''
1561 class MyClass {} 1234 class MyClass {}
1562 main(p) { 1235 main(p) {
1563 var isVariable; 1236 var isVariable;
1564 if (p is MyCla!1) {} 1237 if (p is MyCla!1) {}
1565 var v1 = p is MyCla!2; 1238 var v1 = p is MyCla!2;
1566 var v2 = p is !3; 1239 var v2 = p is !3;
1567 var v2 = p is!4; 1240 var v2 = p is!4;
1568 }''', 1241 }''', <String>[
1569 <String>[ 1242 "1+MyClass",
1570 "1+MyClass", 1243 "2+MyClass",
1571 "2+MyClass", 1244 "3+MyClass",
1572 "3+MyClass", 1245 "3-v1",
1573 "3-v1", 1246 "4+is",
1574 "4+is", 1247 "4-isVariable"
1575 "4-isVariable" 1248 ]);
1576 ]);
1577 1249
1578 buildTests( 1250 buildTests('testCompletion_is_asIdentifierStart', '''
1579 'testCompletion_is_asIdentifierStart',
1580 '''
1581 main(p) { 1251 main(p) {
1582 var isVisible; 1252 var isVisible;
1583 var v1 = is!1; 1253 var v1 = is!1;
1584 var v2 = is!2 1254 var v2 = is!2
1585 }''', 1255 }''', <String>["1+isVisible", "2+isVisible"]);
1586 <String>["1+isVisible", "2+isVisible"]);
1587 1256
1588 buildTests( 1257 buildTests('testCompletion_is_asPrefixedIdentifierStart', '''
1589 'testCompletion_is_asPrefixedIdentifierStart',
1590 '''
1591 class A { 1258 class A {
1592 var isVisible; 1259 var isVisible;
1593 } 1260 }
1594 1261
1595 main(A p) { 1262 main(A p) {
1596 var v1 = p.is!1; 1263 var v1 = p.is!1;
1597 var v2 = p.is!2 1264 var v2 = p.is!2
1598 }''', 1265 }''', <String>["1+isVisible", "2+isVisible"]);
1599 <String>["1+isVisible", "2+isVisible"]);
1600 1266
1601 buildTests( 1267 buildTests('testCompletion_is_incompleteStatement1', '''
1602 'testCompletion_is_incompleteStatement1',
1603 '''
1604 class MyClass {} 1268 class MyClass {}
1605 main(p) { 1269 main(p) {
1606 var justSomeVar; 1270 var justSomeVar;
1607 var v = p is !1 1271 var v = p is !1
1608 }''', 1272 }''', <String>["1+MyClass", "1-justSomeVar"]);
1609 <String>["1+MyClass", "1-justSomeVar"]);
1610 1273
1611 buildTests( 1274 buildTests('testCompletion_is_incompleteStatement2', '''
1612 'testCompletion_is_incompleteStatement2',
1613 '''
1614 class MyClass {} 1275 class MyClass {}
1615 main(p) { 1276 main(p) {
1616 var isVariable; 1277 var isVariable;
1617 var v = p is!1 1278 var v = p is!1
1618 }''', 1279 }''', <String>["1+is", "1-isVariable"]);
1619 <String>["1+is", "1-isVariable"]);
1620 1280
1621 buildTests( 1281 buildTests('testCompletion_keyword_in', '''
1622 'testCompletion_keyword_in', 1282 class Foo { int input = 7; mth() { if (in!1) {}}}''', <String>["1+input"]);
1623 '''
1624 class Foo { int input = 7; mth() { if (in!1) {}}}''',
1625 <String>["1+input"]);
1626 1283
1627 buildTests( 1284 buildTests('testCompletion_keyword_syntheticIdentifier', '''
1628 'testCompletion_keyword_syntheticIdentifier',
1629 '''
1630 main() { 1285 main() {
1631 var caseVar; 1286 var caseVar;
1632 var otherVar; 1287 var otherVar;
1633 var v = case!1 1288 var v = case!1
1634 }''', 1289 }''', <String>["1+caseVar", "1-otherVar"]);
1635 <String>["1+caseVar", "1-otherVar"]);
1636 1290
1637 buildTests( 1291 buildTests('testCompletion_libraryIdentifier_atEOF', '''
1638 'testCompletion_libraryIdentifier_atEOF', 1292 library int.!1''', <String>["1-parse", "1-bool"]);
1639 '''
1640 library int.!1''',
1641 <String>["1-parse", "1-bool"]);
1642 1293
1643 buildTests( 1294 buildTests('testCompletion_libraryIdentifier_notEOF', '''
1644 'testCompletion_libraryIdentifier_notEOF', 1295 library int.!1''', <String>["1-parse", "1-bool"]);
1645 '''
1646 library int.!1''',
1647 <String>["1-parse", "1-bool"]);
1648 1296
1649 buildTests( 1297 buildTests(
1650 'testCompletion_methodRef_asArg_incompatibleFunctionType', 1298 'testCompletion_methodRef_asArg_incompatibleFunctionType',
1651 ''' 1299 '''
1652 foo( f(int p) ) {} 1300 foo( f(int p) ) {}
1653 class Functions { 1301 class Functions {
1654 static myFuncInt(int p) {} 1302 static myFuncInt(int p) {}
1655 static myFuncDouble(double p) {} 1303 static myFuncDouble(double p) {}
1656 } 1304 }
1657 bar(p) {} 1305 bar(p) {}
(...skipping 16 matching lines...) Expand all
1674 bar(p) {} 1322 bar(p) {}
1675 main(p) { 1323 main(p) {
1676 foo( (int p) => Functions.!1; ); 1324 foo( (int p) => Functions.!1; );
1677 }''', 1325 }''',
1678 <String>[ 1326 <String>[
1679 "1+myFunc" /*":" + ProposalKind.METHOD*/, 1327 "1+myFunc" /*":" + ProposalKind.METHOD*/,
1680 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/ 1328 "1-myFunc" /*":" + ProposalKind.METHOD_NAME*/
1681 ], 1329 ],
1682 failingTests: '1'); 1330 failingTests: '1');
1683 1331
1684 buildTests( 1332 buildTests('testCompletion_methodRef_asArg_ofFunctionType', '''
1685 'testCompletion_methodRef_asArg_ofFunctionType',
1686 '''
1687 foo( f(int p) ) {} 1333 foo( f(int p) ) {}
1688 class Functions { 1334 class Functions {
1689 static int myFunc(int p) {} 1335 static int myFunc(int p) {}
1690 } 1336 }
1691 main(p) { 1337 main(p) {
1692 foo(Functions.!1); 1338 foo(Functions.!1);
1693 }''', 1339 }''', <String>[
1694 <String>[ 1340 "1+myFunc" /*":" + ProposalKind.METHOD*/,
1695 "1+myFunc" /*":" + ProposalKind.METHOD*/, 1341 "1+myFunc" /*":" + ProposalKind.METHOD_NAME*/
1696 "1+myFunc" /*":" + ProposalKind.METHOD_NAME*/ 1342 ]);
1697 ]);
1698 1343
1699 buildTests( 1344 buildTests('testCompletion_namedArgument_alreadyUsed', '''
1700 'testCompletion_namedArgument_alreadyUsed', 1345 func({foo}) {} main() { func(foo: 0, fo!1); }''', <String>["1-foo"]);
1701 '''
1702 func({foo}) {} main() { func(foo: 0, fo!1); }''',
1703 <String>["1-foo"]);
1704 1346
1705 buildTests( 1347 buildTests(
1706 'testCompletion_namedArgument_constructor', 1348 'testCompletion_namedArgument_constructor',
1707 ''' 1349 '''
1708 class A {A({foo, bar}) {}} main() { new A(fo!1); }''', 1350 class A {A({foo, bar}) {}} main() { new A(fo!1); }''',
1709 <String>["1+foo", "1-bar"], 1351 <String>["1+foo", "1-bar"],
1710 failingTests: '1'); 1352 failingTests: '1');
1711 1353
1712 buildTests( 1354 buildTests(
1713 'testCompletion_namedArgument_empty', 1355 'testCompletion_namedArgument_empty',
1714 ''' 1356 '''
1715 func({foo, bar}) {} main() { func(!1); }''', 1357 func({foo, bar}) {} main() { func(!1); }''',
1716 <String>[ 1358 <String>[
1717 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/, 1359 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/,
1718 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/ 1360 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/
1719 ], 1361 ],
1720 failingTests: '1'); 1362 failingTests: '1');
1721 1363
1722 buildTests( 1364 buildTests(
1723 'testCompletion_namedArgument_function', 1365 'testCompletion_namedArgument_function',
1724 ''' 1366 '''
1725 func({foo, bar}) {} main() { func(fo!1); }''', 1367 func({foo, bar}) {} main() { func(fo!1); }''',
1726 <String>["1+foo", "1-bar"], 1368 <String>["1+foo", "1-bar"],
1727 failingTests: '1'); 1369 failingTests: '1');
1728 1370
1729 buildTests( 1371 buildTests('testCompletion_namedArgument_notNamed', '''
1730 'testCompletion_namedArgument_notNamed', 1372 func([foo]) {} main() { func(fo!1); }''', <String>["1-foo"]);
1731 '''
1732 func([foo]) {} main() { func(fo!1); }''',
1733 <String>["1-foo"]);
1734 1373
1735 buildTests( 1374 buildTests('testCompletion_namedArgument_unresolvedFunction', '''
1736 'testCompletion_namedArgument_unresolvedFunction', 1375 main() { func(fo!1); }''', <String>["1-foo"]);
1737 '''
1738 main() { func(fo!1); }''',
1739 <String>["1-foo"]);
1740 1376
1741 buildTests( 1377 buildTests('testCompletion_newMemberType1', '''
1742 'testCompletion_newMemberType1',
1743 '''
1744 class Collection{}class List extends Collection{}class Foo { !1 }''', 1378 class Collection{}class List extends Collection{}class Foo { !1 }''',
1745 <String>["1+Collection", "1+List"]); 1379 <String>["1+Collection", "1+List"]);
1746 1380
1747 buildTests( 1381 buildTests('testCompletion_newMemberType2', '''
1748 'testCompletion_newMemberType2',
1749 '''
1750 class Collection{}class List extends Collection{}class Foo {!1}''', 1382 class Collection{}class List extends Collection{}class Foo {!1}''',
1751 <String>["1+Collection", "1+List"]); 1383 <String>["1+Collection", "1+List"]);
1752 1384
1753 buildTests( 1385 buildTests('testCompletion_newMemberType3', '''
1754 'testCompletion_newMemberType3',
1755 '''
1756 class Collection{}class List extends Collection{}class Foo {L!1}''', 1386 class Collection{}class List extends Collection{}class Foo {L!1}''',
1757 <String>["1-Collection", "1+List"]); 1387 <String>["1-Collection", "1+List"]);
1758 1388
1759 buildTests( 1389 buildTests('testCompletion_newMemberType4', '''
1760 'testCompletion_newMemberType4',
1761 '''
1762 class Collection{}class List extends Collection{}class Foo {C!1}''', 1390 class Collection{}class List extends Collection{}class Foo {C!1}''',
1763 <String>["1+Collection", "1-List"]); 1391 <String>["1+Collection", "1-List"]);
1764 1392
1765 buildTests( 1393 buildTests(
1766 'testCompletion_positionalArgument_constructor', 1394 'testCompletion_positionalArgument_constructor',
1767 ''' 1395 '''
1768 class A { 1396 class A {
1769 A([foo, bar]); 1397 A([foo, bar]);
1770 } 1398 }
1771 main() { 1399 main() {
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
1811 A v = new B(); 1439 A v = new B();
1812 v.!1 1440 v.!1
1813 }''', 1441 }''',
1814 <String>[ 1442 <String>[
1815 "1+foo", 1443 "1+foo",
1816 "1-bar,potential=false,declaringType=B", 1444 "1-bar,potential=false,declaringType=B",
1817 "1+bar,potential=true,declaringType=B" 1445 "1+bar,potential=true,declaringType=B"
1818 ], 1446 ],
1819 failingTests: '1'); 1447 failingTests: '1');
1820 1448
1821 buildTests( 1449 buildTests('testCompletion_privateElement_sameLibrary_constructor', '''
1822 'testCompletion_privateElement_sameLibrary_constructor',
1823 '''
1824 class A { 1450 class A {
1825 A._c(); 1451 A._c();
1826 A.c(); 1452 A.c();
1827 } 1453 }
1828 main() { 1454 main() {
1829 new A.!1 1455 new A.!1
1830 }''', 1456 }''', <String>["1+_c", "1+c"]);
1831 <String>["1+_c", "1+c"]);
1832 1457
1833 buildTests( 1458 buildTests('testCompletion_privateElement_sameLibrary_member', '''
1834 'testCompletion_privateElement_sameLibrary_member',
1835 '''
1836 class A { 1459 class A {
1837 _m() {} 1460 _m() {}
1838 m() {} 1461 m() {}
1839 } 1462 }
1840 main(A a) { 1463 main(A a) {
1841 a.!1 1464 a.!1
1842 }''', 1465 }''', <String>["1+_m", "1+m"]);
1843 <String>["1+_m", "1+m"]);
1844 1466
1845 buildTests( 1467 buildTests('testCompletion_propertyAccess_whenClassTarget', '''
1846 'testCompletion_propertyAccess_whenClassTarget',
1847 '''
1848 class A { 1468 class A {
1849 static int FIELD; 1469 static int FIELD;
1850 int field; 1470 int field;
1851 } 1471 }
1852 main() { 1472 main() {
1853 A.!1 1473 A.!1
1854 }''', 1474 }''', <String>["1+FIELD", "1-field"]);
1855 <String>["1+FIELD", "1-field"]);
1856 1475
1857 buildTests( 1476 buildTests('testCompletion_propertyAccess_whenClassTarget_excludeSuper', '''
1858 'testCompletion_propertyAccess_whenClassTarget_excludeSuper',
1859 '''
1860 class A { 1477 class A {
1861 static int FIELD_A; 1478 static int FIELD_A;
1862 static int methodA() {} 1479 static int methodA() {}
1863 } 1480 }
1864 class B extends A { 1481 class B extends A {
1865 static int FIELD_B; 1482 static int FIELD_B;
1866 static int methodB() {} 1483 static int methodB() {}
1867 } 1484 }
1868 main() { 1485 main() {
1869 B.!1; 1486 B.!1;
1870 }''', 1487 }''', <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"]);
1871 <String>["1+FIELD_B", "1-FIELD_A", "1+methodB", "1-methodA"]);
1872 1488
1873 buildTests( 1489 buildTests('testCompletion_propertyAccess_whenInstanceTarget', '''
1874 'testCompletion_propertyAccess_whenInstanceTarget',
1875 '''
1876 class A { 1490 class A {
1877 static int FIELD; 1491 static int FIELD;
1878 int fieldA; 1492 int fieldA;
1879 } 1493 }
1880 class B { 1494 class B {
1881 A a; 1495 A a;
1882 } 1496 }
1883 class C extends A { 1497 class C extends A {
1884 int fieldC; 1498 int fieldC;
1885 } 1499 }
1886 main(B b, C c) { 1500 main(B b, C c) {
1887 b.a.!1; 1501 b.a.!1;
1888 c.!2; 1502 c.!2;
1889 }''', 1503 }''', <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"]);
1890 <String>["1-FIELD", "1+fieldA", "2+fieldC", "2+fieldA"]);
1891 1504
1892 buildTests( 1505 buildTests('testCompletion_return_withIdentifierPrefix', '''
1893 'testCompletion_return_withIdentifierPrefix', 1506 f() { var vvv = 42; return v!1 }''', <String>["1+vvv"]);
1894 '''
1895 f() { var vvv = 42; return v!1 }''',
1896 <String>["1+vvv"]);
1897 1507
1898 buildTests( 1508 buildTests('testCompletion_return_withoutExpression', '''
1899 'testCompletion_return_withoutExpression', 1509 f() { var vvv = 42; return !1 }''', <String>["1+vvv"]);
1900 '''
1901 f() { var vvv = 42; return !1 }''',
1902 <String>["1+vvv"]);
1903 1510
1904 buildTests( 1511 buildTests('testCompletion_staticField1', '''
1905 'testCompletion_staticField1',
1906 '''
1907 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo wer() {x!Xc = y!Yc = MA!1 }}''', 1512 class num{}class Sunflower {static final n!2um MAX_D = 300;nu!3m xc, yc;Sun!4flo wer() {x!Xc = y!Yc = MA!1 }}''',
1908 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"]); 1513 <String>["1+MAX_D", "X+xc", "Y+yc", "2+num", "3+num", "4+Sunflower"]);
1909 1514
1910 buildTests( 1515 buildTests('testCompletion_super_superType', '''
1911 'testCompletion_super_superType',
1912 '''
1913 class A { 1516 class A {
1914 var fa; 1517 var fa;
1915 ma() {} 1518 ma() {}
1916 } 1519 }
1917 class B extends A { 1520 class B extends A {
1918 var fb; 1521 var fb;
1919 mb() {} 1522 mb() {}
1920 main() { 1523 main() {
1921 super.!1 1524 super.!1
1922 } 1525 }
1923 }''', 1526 }''', <String>["1+fa", "1-fb", "1+ma", "1-mb"]);
1924 <String>["1+fa", "1-fb", "1+ma", "1-mb"]);
1925 1527
1926 buildTests( 1528 buildTests(
1927 'testCompletion_superConstructorInvocation_noNamePrefix', 1529 'testCompletion_superConstructorInvocation_noNamePrefix',
1928 ''' 1530 '''
1929 class A { 1531 class A {
1930 A.fooA(); 1532 A.fooA();
1931 A.fooB(); 1533 A.fooB();
1932 A.bar(); 1534 A.bar();
1933 } 1535 }
1934 class B extends A { 1536 class B extends A {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
1990 <String>["1-toString"], 1592 <String>["1-toString"],
1991 failingTests: '1'); 1593 failingTests: '1');
1992 1594
1993 buildTests( 1595 buildTests(
1994 'testCompletion_this_bad_inTopLevelVariableDeclaration', 1596 'testCompletion_this_bad_inTopLevelVariableDeclaration',
1995 ''' 1597 '''
1996 var v = this.!1;''', 1598 var v = this.!1;''',
1997 <String>["1-toString"], 1599 <String>["1-toString"],
1998 failingTests: '1'); 1600 failingTests: '1');
1999 1601
2000 buildTests( 1602 buildTests('testCompletion_this_OK_inConstructorBody', '''
2001 'testCompletion_this_OK_inConstructorBody',
2002 '''
2003 class A { 1603 class A {
2004 var f; 1604 var f;
2005 m() {} 1605 m() {}
2006 A() { 1606 A() {
2007 this.!1; 1607 this.!1;
2008 } 1608 }
2009 }''', 1609 }''', <String>["1+f", "1+m"]);
2010 <String>["1+f", "1+m"]);
2011 1610
2012 buildTests( 1611 buildTests('testCompletion_this_OK_localAndSuper', '''
2013 'testCompletion_this_OK_localAndSuper',
2014 '''
2015 class A { 1612 class A {
2016 var fa; 1613 var fa;
2017 ma() {} 1614 ma() {}
2018 } 1615 }
2019 class B extends A { 1616 class B extends A {
2020 var fb; 1617 var fb;
2021 mb() {} 1618 mb() {}
2022 main() { 1619 main() {
2023 this.!1 1620 this.!1
2024 } 1621 }
2025 }''', 1622 }''', <String>["1+fa", "1+fb", "1+ma", "1+mb"]);
2026 <String>["1+fa", "1+fb", "1+ma", "1+mb"]);
2027 1623
2028 buildTests( 1624 buildTests('testCompletion_topLevelField_init2', '''
2029 'testCompletion_topLevelField_init2',
2030 '''
2031 class DateTime{static var JUN;}final num M = Dat!1eTime.JUN;''', 1625 class DateTime{static var JUN;}final num M = Dat!1eTime.JUN;''',
2032 <String>["1+DateTime", "1-void"]); 1626 <String>["1+DateTime", "1-void"]);
2033 1627
2034 buildTests( 1628 buildTests('testCompletion_while', '''
2035 'testCompletion_while', 1629 class Foo { int boo = 7; mth() { while (b!1) {} }}''', <String>["1+boo"]);
2036 '''
2037 class Foo { int boo = 7; mth() { while (b!1) {} }}''',
2038 <String>["1+boo"]);
2039 } 1630 }
2040 1631
2041 void buildLibraryTests() { 1632 void buildLibraryTests() {
2042 Map<String, String> sources = new HashMap<String, String>(); 1633 Map<String, String> sources = new HashMap<String, String>();
2043 1634
2044 buildTests( 1635 buildTests('test_export_ignoreIfThisLibraryExports', '''
2045 'test_export_ignoreIfThisLibraryExports',
2046 '''
2047 export 'dart:math'; 1636 export 'dart:math';
2048 libFunction() {}; 1637 libFunction() {};
2049 main() { 1638 main() {
2050 !1 1639 !1
2051 }''', 1640 }''', <String>["1-cos", "1+libFunction"]);
2052 <String>["1-cos", "1+libFunction"]);
2053 1641
2054 sources.clear(); 1642 sources.clear();
2055 sources["/lib.dart"] = ''' 1643 sources["/lib.dart"] = '''
2056 library lib; 1644 library lib;
2057 export 'dart:math' hide sin; 1645 export 'dart:math' hide sin;
2058 libFunction() {};'''; 1646 libFunction() {};''';
2059 buildTests( 1647 buildTests(
2060 'test_export_showIfImportLibraryWithExport', 1648 'test_export_showIfImportLibraryWithExport',
2061 ''' 1649 '''
2062 import 'lib.dart' as p; 1650 import 'lib.dart' as p;
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
2165 <String>["1+length", "1+isEmpty", "2+clear"], 1753 <String>["1+length", "1+isEmpty", "2+clear"],
2166 failingTests: '1'); 1754 failingTests: '1');
2167 1755
2168 // TODO Include corelib analysis 1756 // TODO Include corelib analysis
2169 buildTests('testLibrary003', '''class X{var q; f() {q.!1a!2}}''', 1757 buildTests('testLibrary003', '''class X{var q; f() {q.!1a!2}}''',
2170 <String>["1+end", "2+abs", "2-end"], 1758 <String>["1+end", "2+abs", "2-end"],
2171 failingTests: '12'); 1759 failingTests: '12');
2172 1760
2173 // TODO Include corelib analysis 1761 // TODO Include corelib analysis
2174 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s 1762 // Resolving dart:html takes between 2.5s and 30s; json, about 0.12s
2175 buildTests( 1763 buildTests('testLibrary004', '''
2176 'testLibrary004',
2177 '''
2178 library foo; 1764 library foo;
2179 import 'dart:convert' as json; 1765 import 'dart:convert' as json;
2180 class JsonDecoderX{} 1766 class JsonDecoderX{}
2181 f1() {var x=new json.!1} 1767 f1() {var x=new json.!1}
2182 f2() {var x=new json.JsonDe!2} 1768 f2() {var x=new json.JsonDe!2}
2183 f3() {var x=new json.JsonDecoder!3}''', 1769 f3() {var x=new json.JsonDecoder!3}''', <String>[
2184 <String>[ 1770 "1+JsonDecoder",
2185 "1+JsonDecoder", 1771 "1-JsonDecoderX",
2186 "1-JsonDecoderX", 1772 "2+JsonDecoder",
2187 "2+JsonDecoder", 1773 "2-JsonDecoderX",
2188 "2-JsonDecoderX", 1774 "3+JsonDecoder",
2189 "3+JsonDecoder", 1775 "3-JsonDecoderX"
2190 "3-JsonDecoderX" 1776 ]);
2191 ]);
2192 1777
2193 // TODO Enable after type propagation is implemented. Not yet. 1778 // TODO Enable after type propagation is implemented. Not yet.
2194 // TODO Include corelib analysis 1779 // TODO Include corelib analysis
2195 buildTests('testLibrary005', 1780 buildTests('testLibrary005',
2196 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', <String>["1+abs"], 1781 '''var PHI;main(){PHI=5.3;PHI.abs().!1 Object x;}''', <String>["1+abs"],
2197 failingTests: '1'); 1782 failingTests: '1');
2198 1783
2199 // Exercise import and export handling. 1784 // Exercise import and export handling.
2200 // Libraries are defined in partial order of increasing dependency. 1785 // Libraries are defined in partial order of increasing dependency.
2201 sources.clear(); 1786 sources.clear();
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
2316 "3+Y", 1901 "3+Y",
2317 "4+Y", 1902 "4+Y",
2318 "4-m", 1903 "4-m",
2319 "4-X" 1904 "4-X"
2320 ], 1905 ],
2321 extraFiles: sources, 1906 extraFiles: sources,
2322 failingTests: '1234'); 1907 failingTests: '1234');
2323 } 1908 }
2324 1909
2325 void buildNumberedTests() { 1910 void buildNumberedTests() {
2326 buildTests( 1911 buildTests('test001', '''
2327 'test001',
2328 '''
2329 void r1(var v) { 1912 void r1(var v) {
2330 v.!1toString!2().!3hash!4Code 1913 v.!1toString!2().!3hash!4Code
2331 }''', 1914 }''', <String>[
2332 <String>[ 1915 "1+toString",
2333 "1+toString", 1916 "1-==",
2334 "1-==", 1917 "2+toString",
2335 "2+toString", 1918 "3+hashCode",
2336 "3+hashCode", 1919 "3+toString",
2337 "3+toString", 1920 "4+hashCode",
2338 "4+hashCode", 1921 "4-toString"
2339 "4-toString" 1922 ]);
2340 ]);
2341 1923
2342 buildTests( 1924 buildTests('test002', '''
2343 'test002',
2344 '''
2345 void r2(var vim) { 1925 void r2(var vim) {
2346 v!1.toString() 1926 v!1.toString()
2347 }''', 1927 }''', <String>["1+vim"]);
2348 <String>["1+vim"]);
2349 1928
2350 buildTests( 1929 buildTests('test003', '''
2351 'test003',
2352 '''
2353 class A { 1930 class A {
2354 int a() => 3; 1931 int a() => 3;
2355 int b() => this.!1a(); 1932 int b() => this.!1a();
2356 }''', 1933 }''', <String>["1+a"]);
2357 <String>["1+a"]);
2358 1934
2359 buildTests( 1935 buildTests(
2360 'test004', 1936 'test004',
2361 ''' 1937 '''
2362 class A { 1938 class A {
2363 int x; 1939 int x;
2364 A() : this.!1x = 1; 1940 A() : this.!1x = 1;
2365 A.b() : this(); 1941 A.b() : this();
2366 A.c() : this.!2b(); 1942 A.c() : this.!2b();
2367 g() => new A.!3c(); 1943 g() => new A.!3c();
(...skipping 27 matching lines...) Expand all
2395 "2-void", 1971 "2-void",
2396 "2-null", 1972 "2-null",
2397 "2-false", 1973 "2-false",
2398 "3+vf", 1974 "3+vf",
2399 "3+vq", 1975 "3+vq",
2400 "3+vim", 1976 "3+vim",
2401 "3-A" 1977 "3-A"
2402 ], 1978 ],
2403 failingTests: '1'); 1979 failingTests: '1');
2404 1980
2405 buildTests( 1981 buildTests('test006', '''
2406 'test006',
2407 '''
2408 void r2(var vim, {va: 2, b: 3}) { 1982 void r2(var vim, {va: 2, b: 3}) {
2409 v!1.toString() 1983 v!1.toString()
2410 }''', 1984 }''', <String>["1+va", "1-b"]);
2411 <String>["1+va", "1-b"]);
2412 1985
2413 buildTests( 1986 buildTests('test007', '''
2414 'test007',
2415 '''
2416 void r2(var vim, [va: 2, b: 3]) { 1987 void r2(var vim, [va: 2, b: 3]) {
2417 v!1.toString() 1988 v!1.toString()
2418 }''', 1989 }''', <String>["1+va", "1-b"]);
2419 <String>["1+va", "1-b"]);
2420 1990
2421 // keywords 1991 // keywords
2422 buildTests( 1992 buildTests(
2423 'test008', 1993 'test008',
2424 ''' 1994 '''
2425 !1class Aclass {} 1995 !1class Aclass {}
2426 class Bclass !2extends!3 !4Aclass {} 1996 class Bclass !2extends!3 !4Aclass {}
2427 !5abstract class Eclass implements Aclass, Bclass {} 1997 !5abstract class Eclass implements Aclass, Bclass {}
2428 class Fclass extends Bclass !6with !7 Eclass {}''', 1998 class Fclass extends Bclass !6with !7 Eclass {}''',
2429 <String>[ 1999 <String>[
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
2626 "7+show", 2196 "7+show",
2627 "8-null" 2197 "8-null"
2628 ], 2198 ],
2629 failingTests: '234567'); //TODO(jwren) 234 failing as correct selection 2199 failingTests: '234567'); //TODO(jwren) 234 failing as correct selection
2630 // offset assertions can't be passed into buildTests(..) 2200 // offset assertions can't be passed into buildTests(..)
2631 2201
2632 // keywords 2202 // keywords
2633 buildTests('test018', '''!1part !2of foo;''', <String>["1+part", "2+of"], 2203 buildTests('test018', '''!1part !2of foo;''', <String>["1+part", "2+of"],
2634 failingTests: '12'); 2204 failingTests: '12');
2635 2205
2636 buildTests( 2206 buildTests('test019', '''
2637 'test019',
2638 '''
2639 var truefalse = 0; 2207 var truefalse = 0;
2640 var falsetrue = 1; 2208 var falsetrue = 1;
2641 main() { 2209 main() {
2642 var foo = true!1 2210 var foo = true!1
2643 }''', 2211 }''', <String>["1+true", "1+truefalse", "1-falsetrue"]);
2644 <String>["1+true", "1+truefalse", "1-falsetrue"]);
2645 2212
2646 buildTests('test020', '''var x = null.!1''', <String>["1+toString"]); 2213 buildTests('test020', '''var x = null.!1''', <String>["1+toString"]);
2647 2214
2648 buildTests('test021', '''var x = .!1''', <String>["1-toString"]); 2215 buildTests('test021', '''var x = .!1''', <String>["1-toString"]);
2649 2216
2650 buildTests('test022', '''var x = .!1;''', <String>["1-toString"]); 2217 buildTests('test022', '''var x = .!1;''', <String>["1-toString"]);
2651 2218
2652 buildTests( 2219 buildTests('test023', '''
2653 'test023',
2654 '''
2655 class Map{getKeys(){}} 2220 class Map{getKeys(){}}
2656 class X { 2221 class X {
2657 static x1(Map m) { 2222 static x1(Map m) {
2658 m.!1getKeys; 2223 m.!1getKeys;
2659 } 2224 }
2660 x2(Map m) { 2225 x2(Map m) {
2661 m.!2getKeys; 2226 m.!2getKeys;
2662 } 2227 }
2663 }''', 2228 }''', <String>["1+getKeys", "2+getKeys"]);
2664 <String>["1+getKeys", "2+getKeys"]);
2665 2229
2666 // Note lack of semicolon following completion location 2230 // Note lack of semicolon following completion location
2667 buildTests( 2231 buildTests('test024', '''
2668 'test024',
2669 '''
2670 class List{factory List.from(Iterable other) {}} 2232 class List{factory List.from(Iterable other) {}}
2671 class F { 2233 class F {
2672 f() { 2234 f() {
2673 new List.!1 2235 new List.!1
2674 } 2236 }
2675 }''', 2237 }''', <String>["1+from"]);
2676 <String>["1+from"]);
2677 2238
2678 buildTests( 2239 buildTests('test025', '''
2679 'test025',
2680 '''
2681 class R { 2240 class R {
2682 static R _m; 2241 static R _m;
2683 static R m; 2242 static R m;
2684 f() { 2243 f() {
2685 var a = !1m; 2244 var a = !1m;
2686 var b = _!2m; 2245 var b = _!2m;
2687 var c = !3g(); 2246 var c = !3g();
2688 } 2247 }
2689 static g() { 2248 static g() {
2690 var a = !4m; 2249 var a = !4m;
(...skipping 11 matching lines...) Expand all
2702 static g() { 2261 static g() {
2703 var q = R._!Am; 2262 var q = R._!Am;
2704 var g = R.!Bm; 2263 var g = R.!Bm;
2705 var h = R.!Cg(); 2264 var h = R.!Cg();
2706 } 2265 }
2707 h() { 2266 h() {
2708 var q = R._!Dm; 2267 var q = R._!Dm;
2709 var g = R.!Em; 2268 var g = R.!Em;
2710 var h = R.!Fg(); 2269 var h = R.!Fg();
2711 } 2270 }
2712 }''', 2271 }''', <String>[
2713 <String>[ 2272 "1+m",
2714 "1+m", 2273 "2+_m",
2715 "2+_m", 2274 "3+g",
2716 "3+g", 2275 "4+m",
2717 "4+m", 2276 "5+_m",
2718 "5+_m", 2277 "6+g",
2719 "6+g", 2278 "7-g",
2720 "7-g", 2279 "8-m",
2721 "8-m", 2280 "9-_m",
2722 "9-_m", 2281 "A+_m",
2723 "A+_m", 2282 "B+m",
2724 "B+m", 2283 "C+g",
2725 "C+g", 2284 "D+_m",
2726 "D+_m", 2285 "E+m",
2727 "E+m", 2286 "F+g"
2728 "F+g" 2287 ]);
2729 ]);
2730 2288
2731 buildTests('test026', '''var aBcD; var x=ab!1''', <String>["1+aBcD"]); 2289 buildTests('test026', '''var aBcD; var x=ab!1''', <String>["1+aBcD"]);
2732 2290
2733 buildTests( 2291 buildTests(
2734 'test027', '''m(){try{}catch(eeee,ssss){s!1}''', <String>["1+ssss"]); 2292 'test027', '''m(){try{}catch(eeee,ssss){s!1}''', <String>["1+ssss"]);
2735 2293
2736 buildTests('test028', '''m(){var isX=3;if(is!1)''', <String>["1+isX"]); 2294 buildTests('test028', '''m(){var isX=3;if(is!1)''', <String>["1+isX"]);
2737 2295
2738 buildTests('test029', '''m(){[1].forEach((x)=>!1x);}''', <String>["1+x"]); 2296 buildTests('test029', '''m(){[1].forEach((x)=>!1x);}''', <String>["1+x"]);
2739 2297
2740 buildTests('test030', '''n(){[1].forEach((x){!1});}''', <String>["1+x"]); 2298 buildTests('test030', '''n(){[1].forEach((x){!1});}''', <String>["1+x"]);
2741 2299
2742 buildTests( 2300 buildTests(
2743 'test031', 2301 'test031',
2744 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''', 2302 '''class Caster {} m() {try {} on Cas!1ter catch (CastBlock) {!2}}''',
2745 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"]); 2303 <String>["1+Caster", "1-CastBlock", "2+Caster", "2+CastBlock"]);
2746 2304
2747 buildTests( 2305 buildTests('test032', '''
2748 'test032',
2749 '''
2750 const ONE = 1; 2306 const ONE = 1;
2751 const ICHI = 10; 2307 const ICHI = 10;
2752 const UKSI = 100; 2308 const UKSI = 100;
2753 const EIN = 1000; 2309 const EIN = 1000;
2754 m() { 2310 m() {
2755 int x; 2311 int x;
2756 switch (x) { 2312 switch (x) {
2757 case !3ICHI: 2313 case !3ICHI:
2758 case UKSI: 2314 case UKSI:
2759 case EIN!2: 2315 case EIN!2:
2760 case ONE!1: return; 2316 case ONE!1: return;
2761 default: return; 2317 default: return;
2762 } 2318 }
2763 }''', 2319 }''', <String>[
2764 <String>[ 2320 "1+ONE",
2765 "1+ONE", 2321 "1-UKSI",
2766 "1-UKSI", 2322 "2+EIN",
2767 "2+EIN", 2323 "2-ICHI",
2768 "2-ICHI", 2324 "3+ICHI",
2769 "3+ICHI", 2325 "3+UKSI",
2770 "3+UKSI", 2326 "3+EIN",
2771 "3+EIN", 2327 "3+ONE"
2772 "3+ONE" 2328 ]);
2773 ]);
2774 2329
2775 buildTests( 2330 buildTests(
2776 'test033', 2331 'test033',
2777 '''class A{}class B extends A{b(){}}class C implements A {c(){}}class X{ x(){A f;f.!1}}''', 2332 '''class A{}class B extends A{b(){}}class C implements A {c(){}}class X{ x(){A f;f.!1}}''',
2778 <String>["1+b", "1-c"], 2333 <String>["1+b", "1-c"],
2779 failingTests: '1'); 2334 failingTests: '1');
2780 2335
2781 // TODO(scheglov) decide what to do with Type for untyped field (not 2336 // TODO(scheglov) decide what to do with Type for untyped field (not
2782 // supported by the new store) 2337 // supported by the new store)
2783 // test analysis of untyped fields and top-level vars 2338 // test analysis of untyped fields and top-level vars
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after
2953 } else { 2508 } else {
2954 ++expectedPassCount; 2509 ++expectedPassCount;
2955 test(testName, () { 2510 test(testName, () {
2956 CompletionTestCase test = new CompletionTestCase(); 2511 CompletionTestCase test = new CompletionTestCase();
2957 return test.runTest(spec, extraFiles); 2512 return test.runTest(spec, extraFiles);
2958 }); 2513 });
2959 } 2514 }
2960 } 2515 }
2961 } 2516 }
2962 } 2517 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_server_test.dart ('k') | pkg/analysis_server/test/context_manager_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698