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

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

Issue 1005483002: add completion in type argument list (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: format 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.services.completion.util; 5 library test.services.completion.util;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart' as protocol 9 import 'package:analysis_server/src/protocol.dart' as protocol
10 show Element, ElementKind; 10 show Element, ElementKind;
(...skipping 3382 matching lines...) Expand 10 before | Expand all | Expand 10 after
3393 test_TopLevelVariableDeclaration_untyped_name() { 3393 test_TopLevelVariableDeclaration_untyped_name() {
3394 // SimpleIdentifier VariableDeclaration VariableDeclarationList 3394 // SimpleIdentifier VariableDeclaration VariableDeclarationList
3395 // TopLevelVariableDeclaration 3395 // TopLevelVariableDeclaration
3396 addTestSource('class A {} var ^'); 3396 addTestSource('class A {} var ^');
3397 computeFast(); 3397 computeFast();
3398 return computeFull((bool result) { 3398 return computeFull((bool result) {
3399 assertNoSuggestions(); 3399 assertNoSuggestions();
3400 }); 3400 });
3401 } 3401 }
3402 3402
3403 test_TypeArgumentList() {
3404 // SimpleIdentifier BinaryExpression ExpressionStatement
3405 addSource('/testA.dart', '''
3406 class C1 {int x;}
3407 F1() => 0;
3408 typedef String T1(int blat);''');
3409 addTestSource('''
3410 import "/testA.dart";'
3411 class C2 {int x;}
3412 F2() => 0;
3413 typedef int T2(int blat);
3414 class C<E> {}
3415 main() { C<^> c; }''');
3416 computeFast();
3417 return computeFull((bool result) {
3418 expect(request.replacementOffset, completionOffset);
3419 expect(request.replacementLength, 0);
3420 assertSuggestImportedClass('Object');
3421 assertSuggestImportedClass('C1');
3422 assertSuggestImportedFunctionTypeAlias('T1', 'String');
3423 assertSuggestLocalClass('C2');
3424 assertSuggestLocalFunctionTypeAlias('T2', 'int');
3425 assertNotSuggested('F1');
3426 assertNotSuggested('F2');
3427 });
3428 }
3429
3430 test_TypeArgumentList2() {
3431 // TypeName TypeArgumentList TypeName
3432 addSource('/testA.dart', '''
3433 class C1 {int x;}
3434 F1() => 0;
3435 typedef String T1(int blat);''');
3436 addTestSource('''
3437 import "/testA.dart";'
3438 class C2 {int x;}
3439 F2() => 0;
3440 typedef int T2(int blat);
3441 class C<E> {}
3442 main() { C<C^> c; }''');
3443 computeFast();
3444 return computeFull((bool result) {
3445 expect(request.replacementOffset, completionOffset - 1);
3446 expect(request.replacementLength, 1);
3447 assertSuggestImportedClass('C1');
3448 assertSuggestLocalClass('C2');
3449 });
3450 }
3451
3403 test_VariableDeclaration_name() { 3452 test_VariableDeclaration_name() {
3404 // SimpleIdentifier VariableDeclaration VariableDeclarationList 3453 // SimpleIdentifier VariableDeclaration VariableDeclarationList
3405 // VariableDeclarationStatement Block 3454 // VariableDeclarationStatement Block
3406 addSource('/testB.dart', ''' 3455 addSource('/testB.dart', '''
3407 lib B; 3456 lib B;
3408 foo() { } 3457 foo() { }
3409 class _B { } 3458 class _B { }
3410 class X {X.c(); X._d(); z() {}}'''); 3459 class X {X.c(); X._d(); z() {}}''');
3411 addTestSource(''' 3460 addTestSource('''
3412 import "/testB.dart"; 3461 import "/testB.dart";
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
3481 assertNotSuggested('bar2'); 3530 assertNotSuggested('bar2');
3482 assertNotSuggested('_B'); 3531 assertNotSuggested('_B');
3483 assertSuggestLocalClass('Y'); 3532 assertSuggestLocalClass('Y');
3484 assertSuggestLocalClass('C'); 3533 assertSuggestLocalClass('C');
3485 assertSuggestLocalVariable('f', null); 3534 assertSuggestLocalVariable('f', null);
3486 assertNotSuggested('x'); 3535 assertNotSuggested('x');
3487 assertNotSuggested('e'); 3536 assertNotSuggested('e');
3488 }); 3537 });
3489 } 3538 }
3490 } 3539 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698