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

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

Issue 972193002: include library prefix suggestions when suggesting constructors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 9 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.completion.support; 5 library test.completion.support;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:collection'; 8 import 'dart:collection';
9 9
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 class L{var k;void.!1}''', <String>["1-k"]); 232 class L{var k;void.!1}''', <String>["1-k"]);
233 233
234 buildTests('testCommentSnippets044', ''' 234 buildTests('testCommentSnippets044', '''
235 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''', 235 class List{}class XXX {XXX.fisk();}main() {main(); new !1}}''',
236 <String>["1+List", "1+XXX.fisk"], failingTests: '1'); 236 <String>["1+List", "1+XXX.fisk"], failingTests: '1');
237 237
238 buildTests('testCommentSnippets047', ''' 238 buildTests('testCommentSnippets047', '''
239 f(){int x;int y=!1;}''', <String>["1+x"]); 239 f(){int x;int y=!1;}''', <String>["1+x"]);
240 240
241 buildTests('testCommentSnippets048', ''' 241 buildTests('testCommentSnippets048', '''
242 import 'dart:convert' as json;f() {var x=new js!1}''', <String>["1+json"], faili ngTests: '1'); 242 import 'dart:convert' as json;f() {var x=new js!1}''', <String>["1+json"]);
243 243
244 buildTests('testCommentSnippets049', ''' 244 buildTests('testCommentSnippets049', '''
245 import 'dart:convert' as json; 245 import 'dart:convert' as json;
246 import 'dart:convert' as jxx; 246 import 'dart:convert' as jxx;
247 class JsonDecoderX{} 247 class JsonDecoderX{}
248 f1() {var x=new !2j!1s!3}''', <String>[ 248 f1() {var x=new !2j!1s!3}''', <String>[
249 "1+json", 249 "1+json",
250 "1+jxx", 250 "1+jxx",
251 "2+json", 251 "2+json",
252 "2+jxx", 252 "2+jxx",
253 "2-JsonDecoder", 253 "2-JsonDecoder",
254 "3+json", 254 "3+json",
255 "3-jxx" 255 "3-jxx"
256 ], failingTests: '123'); 256 ]);
257 257
258 buildTests('testCommentSnippets050', ''' 258 buildTests('testCommentSnippets050', '''
259 class xdr { 259 class xdr {
260 xdr(); 260 xdr();
261 const xdr.a(a,b,c); 261 const xdr.a(a,b,c);
262 xdr.b(); 262 xdr.b();
263 f() => 3; 263 f() => 3;
264 } 264 }
265 class xa{} 265 class xa{}
266 k() { 266 k() {
267 new x!1dr().f(); 267 new x!1dr().f();
268 const x!2dr.!3a(1, 2, 3); 268 const x!2dr.!3a(1, 2, 3);
269 }''', <String>[ 269 }''', <String>[
270 "1+xdr", 270 "1+xdr",
271 "1+xa", 271 "1+xa",
272 "1+xdr.a", 272 "1+xdr.a",
273 "1+xdr.b", 273 "1+xdr.b",
274 "2-xa", 274 "2+xa", // suggest default constructor
275 "2-xdr", 275 "2+xdr", // suggest normal constructor
276 "2+xdr.a", 276 "2+xdr.a",
277 "2-xdr.b", 277 "2+xdr.b", // suggest named constructor
278 "3-b", 278 "3+b", // suggest named constructor
279 "3+a" 279 "3+a"
280 ], failingTests: '23'); 280 ]);
281 281
282 // Type propagation. 282 // Type propagation.
283 buildTests('testCommentSnippets051', ''' 283 buildTests('testCommentSnippets051', '''
284 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}} 284 class String{int length(){} String toUpperCase(){} bool isEmpty(){}}class Map{ge tKeys(){}}
285 void r() { 285 void r() {
286 var v; 286 var v;
287 if (v is String) { 287 if (v is String) {
288 v.!1length; 288 v.!1length;
289 v.!2getKeys; 289 v.!2getKeys;
290 } 290 }
(...skipping 983 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 class A {A({foo, bar}) {}} main() { new A(fo!1); }''', 1274 class A {A({foo, bar}) {}} main() { new A(fo!1); }''',
1275 <String>["1+foo", "1-bar"], failingTests: '1'); 1275 <String>["1+foo", "1-bar"], failingTests: '1');
1276 1276
1277 buildTests('testCompletion_namedArgument_empty', ''' 1277 buildTests('testCompletion_namedArgument_empty', '''
1278 func({foo, bar}) {} main() { func(!1); }''', <String>[ 1278 func({foo, bar}) {} main() { func(!1); }''', <String>[
1279 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/, 1279 "1+foo" /*":" + ProposalKind.NAMED_ARGUMENT*/,
1280 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/ 1280 "1-foo" /*":" + ProposalKind.OPTIONAL_ARGUMENT*/
1281 ], failingTests: '1'); 1281 ], failingTests: '1');
1282 1282
1283 buildTests('testCompletion_namedArgument_function', ''' 1283 buildTests('testCompletion_namedArgument_function', '''
1284 func({foo, bar}) {} main() { func(fo!1); }''', <String>["1+foo", "1-bar"], 1284 func({foo, bar}) {} main() { func(fo!1); }''',
1285 failingTests: '1'); 1285 <String>["1+foo", "1-bar"], failingTests: '1');
1286 1286
1287 buildTests('testCompletion_namedArgument_notNamed', ''' 1287 buildTests('testCompletion_namedArgument_notNamed', '''
1288 func([foo]) {} main() { func(fo!1); }''', <String>["1-foo"]); 1288 func([foo]) {} main() { func(fo!1); }''', <String>["1-foo"]);
1289 1289
1290 buildTests('testCompletion_namedArgument_unresolvedFunction', ''' 1290 buildTests('testCompletion_namedArgument_unresolvedFunction', '''
1291 main() { func(fo!1); }''', <String>["1-foo"]); 1291 main() { func(fo!1); }''', <String>["1-foo"]);
1292 1292
1293 buildTests('testCompletion_newMemberType1', ''' 1293 buildTests('testCompletion_newMemberType1', '''
1294 class Collection{}class List extends Collection{}class Foo { !1 }''', 1294 class Collection{}class List extends Collection{}class Foo { !1 }''',
1295 <String>["1+Collection", "1+List"], failingTests: '1'); 1295 <String>["1+Collection", "1+List"], failingTests: '1');
(...skipping 1001 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 } else { 2297 } else {
2298 ++expectedPassCount; 2298 ++expectedPassCount;
2299 tester(testName, () { 2299 tester(testName, () {
2300 CompletionTestCase test = new CompletionTestCase(); 2300 CompletionTestCase test = new CompletionTestCase();
2301 return test.runTest(spec, extraFiles); 2301 return test.runTest(spec, extraFiles);
2302 }); 2302 });
2303 } 2303 }
2304 } 2304 }
2305 } 2305 }
2306 } 2306 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698