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

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

Issue 1002713003: completions in map literals (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge cleanup 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 2607 matching lines...) Expand 10 before | Expand all | Expand 10 after
2618 2618
2619 test_Literal_string() { 2619 test_Literal_string() {
2620 // SimpleStringLiteral ExpressionStatement Block 2620 // SimpleStringLiteral ExpressionStatement Block
2621 addTestSource('class A {a() {"hel^lo"}}'); 2621 addTestSource('class A {a() {"hel^lo"}}');
2622 computeFast(); 2622 computeFast();
2623 return computeFull((bool result) { 2623 return computeFull((bool result) {
2624 assertNoSuggestions(); 2624 assertNoSuggestions();
2625 }); 2625 });
2626 } 2626 }
2627 2627
2628 test_MapLiteralEntry() {
2629 // MapLiteralEntry MapLiteral VariableDeclaration
2630 addSource('/testA.dart', '''
2631 int T1;
2632 F1() { }
2633 typedef D1();
2634 class C1 {C1(this.x) { } int x;}''');
2635 addTestSource('''
2636 import "/testA.dart";
2637 int T2;
2638 F2() { }
2639 typedef D2();
2640 class C2 { }
2641 foo = {^''');
2642 computeFast();
2643 return computeFull((bool result) {
2644 expect(request.replacementOffset, completionOffset);
2645 expect(request.replacementLength, 0);
2646 assertSuggestImportedClass('Object');
2647 // TODO(danrubel) Should be top level variable
2648 if (computer is ImportedComputer) {
2649 assertSuggestGetter('T1', 'int');
2650 // assertSuggestImportedTopLevelVar('T1', 'int');
2651 }
2652 assertSuggestImportedFunction('F1', null);
2653 assertSuggestImportedFunctionTypeAlias('D1', null);
2654 assertSuggestImportedClass('C1');
2655 assertSuggestLocalTopLevelVar('T2', 'int');
2656 assertSuggestLocalFunction('F2', null);
2657 assertSuggestLocalFunctionTypeAlias('D2', null);
2658 assertSuggestLocalClass('C2');
2659 });
2660 }
2661
2662 test_MapLiteralEntry1() {
2663 // MapLiteralEntry MapLiteral VariableDeclaration
2664 addSource('/testA.dart', '''
2665 int T1;
2666 F1() { }
2667 typedef D1();
2668 class C1 {C1(this.x) { } int x;}''');
2669 addTestSource('''
2670 import "/testA.dart";
2671 int T2;
2672 F2() { }
2673 typedef D2();
2674 class C2 { }
2675 foo = {T^''');
2676 computeFast();
2677 return computeFull((bool result) {
2678 expect(request.replacementOffset, completionOffset - 1);
2679 expect(request.replacementLength, 1);
2680 // TODO(danrubel) Should be top level variable
2681 if (computer is ImportedComputer) {
2682 assertSuggestGetter('T1', 'int');
2683 // assertSuggestImportedTopLevelVar('T1', 'int');
2684 }
2685 assertSuggestLocalTopLevelVar('T2', 'int');
2686 });
2687 }
2688
2689 test_MapLiteralEntry2() {
2690 // SimpleIdentifier MapLiteralEntry MapLiteral VariableDeclaration
2691 addSource('/testA.dart', '''
2692 int T1;
2693 F1() { }
2694 typedef D1();
2695 class C1 {C1(this.x) { } int x;}''');
2696 addTestSource('''
2697 import "/testA.dart";
2698 int T2;
2699 F2() { }
2700 typedef D2();
2701 class C2 { }
2702 foo = {7:T^};''');
2703 computeFast();
2704 return computeFull((bool result) {
2705 expect(request.replacementOffset, completionOffset - 1);
2706 expect(request.replacementLength, 1);
2707 // TODO(danrubel) Should be top level variable
2708 if (computer is ImportedComputer) {
2709 assertSuggestGetter('T1', 'int');
2710 // assertSuggestImportedTopLevelVar('T1', 'int');
2711 }
2712 assertSuggestLocalTopLevelVar('T2', 'int');
2713 });
2714 }
2715
2628 test_MethodDeclaration_body_getters() { 2716 test_MethodDeclaration_body_getters() {
2629 // Block BlockFunctionBody MethodDeclaration 2717 // Block BlockFunctionBody MethodDeclaration
2630 addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}'); 2718 addTestSource('class A {@deprecated X get f => 0; Z a() {^} get _g => 1;}');
2631 computeFast(); 2719 computeFast();
2632 return computeFull((bool result) { 2720 return computeFull((bool result) {
2633 expect(request.replacementOffset, completionOffset); 2721 expect(request.replacementOffset, completionOffset);
2634 expect(request.replacementLength, 0); 2722 expect(request.replacementLength, 0);
2635 CompletionSuggestion methodA = assertSuggestLocalMethod('a', 'A', 'Z'); 2723 CompletionSuggestion methodA = assertSuggestLocalMethod('a', 'A', 'Z');
2636 if (methodA != null) { 2724 if (methodA != null) {
2637 expect(methodA.element.isDeprecated, isFalse); 2725 expect(methodA.element.isDeprecated, isFalse);
(...skipping 892 matching lines...) Expand 10 before | Expand all | Expand 10 after
3530 assertNotSuggested('bar2'); 3618 assertNotSuggested('bar2');
3531 assertNotSuggested('_B'); 3619 assertNotSuggested('_B');
3532 assertSuggestLocalClass('Y'); 3620 assertSuggestLocalClass('Y');
3533 assertSuggestLocalClass('C'); 3621 assertSuggestLocalClass('C');
3534 assertSuggestLocalVariable('f', null); 3622 assertSuggestLocalVariable('f', null);
3535 assertNotSuggested('x'); 3623 assertNotSuggested('x');
3536 assertNotSuggested('e'); 3624 assertNotSuggested('e');
3537 }); 3625 });
3538 } 3626 }
3539 } 3627 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698