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

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

Issue 1503463002: move combinator contributor to new task model (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove old code Created 5 years 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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 library test.services.completion.dart.combinator;
6
7 import 'package:analysis_server/plugin/protocol/protocol.dart';
8 import 'package:analysis_server/src/services/completion/combinator_contributor.d art';
9 import 'package:analysis_server/src/services/completion/dart_completion_manager. dart';
10 import 'package:test_reflective_loader/test_reflective_loader.dart';
11
12 import '../../utils.dart';
13 import 'completion_test_util.dart';
14
15 main() {
16 initializeTestEnvironment();
17 defineReflectiveTests(CombinatorContributorTest);
18 }
19
20 @reflectiveTest
21 class CombinatorContributorTest extends AbstractCompletionTest {
22 @override
23 void setUpContributor() {
24 contributor = new CombinatorContributor();
25 }
26
27 test_Block_inherited_local() {
28 // Block BlockFunctionBody MethodDeclaration ClassDeclaration
29 addTestSource('''
30 class F { var f1; f2() { } }
31 class E extends F { var e1; e2() { } }
32 class I { int i1; i2() { } }
33 class M { var m1; int m2() { } }
34 class A extends E implements I with M {a() {^}}''');
35 computeFast();
36 return computeFull((bool result) {
37 assertNoSuggestions();
38 });
39 }
40
41 test_Combinator_hide() {
42 // SimpleIdentifier HideCombinator ImportDirective
43 addSource(
44 '/testAB.dart',
45 '''
46 library libAB;
47 part '/partAB.dart';
48 class A { }
49 class B { }''');
50 addSource(
51 '/partAB.dart',
52 '''
53 part of libAB;
54 var T1;
55 PB F1() => new PB();
56 class PB { }''');
57 addSource(
58 '/testCD.dart',
59 '''
60 class C { }
61 class D { }''');
62 addTestSource('''
63 import "/testAB.dart" hide ^;
64 import "/testCD.dart";
65 class X {}''');
66 computeFast();
67 return computeFull((bool result) {
68 assertSuggestClass('A',
69 relevance: DART_RELEVANCE_DEFAULT,
70 kind: CompletionSuggestionKind.IDENTIFIER);
71 assertSuggestClass('B',
72 relevance: DART_RELEVANCE_DEFAULT,
73 kind: CompletionSuggestionKind.IDENTIFIER);
74 assertSuggestClass('PB',
75 relevance: DART_RELEVANCE_DEFAULT,
76 kind: CompletionSuggestionKind.IDENTIFIER);
77 assertSuggestTopLevelVar('T1', null, DART_RELEVANCE_DEFAULT,
78 CompletionSuggestionKind.IDENTIFIER);
79 assertSuggestFunction('F1', 'PB',
80 kind: CompletionSuggestionKind.IDENTIFIER);
81 assertNotSuggested('C');
82 assertNotSuggested('D');
83 assertNotSuggested('X');
84 assertNotSuggested('Object');
85 });
86 }
87
88 test_Combinator_show() {
89 // SimpleIdentifier HideCombinator ImportDirective
90 addSource(
91 '/testAB.dart',
92 '''
93 library libAB;
94 part '/partAB.dart';
95 class A { }
96 class B { }''');
97 addSource(
98 '/partAB.dart',
99 '''
100 part of libAB;
101 var T1;
102 PB F1() => new PB();
103 typedef PB2 F2(int blat);
104 class Clz = Object with Object;
105 class PB { }''');
106 addSource(
107 '/testCD.dart',
108 '''
109 class C { }
110 class D { }''');
111 addTestSource('''
112 import "/testAB.dart" show ^;
113 import "/testCD.dart";
114 class X {}''');
115 computeFast();
116 return computeFull((bool result) {
117 assertSuggestClass('A',
118 relevance: DART_RELEVANCE_DEFAULT,
119 kind: CompletionSuggestionKind.IDENTIFIER);
120 assertSuggestClass('B',
121 relevance: DART_RELEVANCE_DEFAULT,
122 kind: CompletionSuggestionKind.IDENTIFIER);
123 assertSuggestClass('PB',
124 relevance: DART_RELEVANCE_DEFAULT,
125 kind: CompletionSuggestionKind.IDENTIFIER);
126 assertSuggestTopLevelVar('T1', null, DART_RELEVANCE_DEFAULT,
127 CompletionSuggestionKind.IDENTIFIER);
128 assertSuggestFunction('F1', 'PB',
129 kind: CompletionSuggestionKind.IDENTIFIER);
130 assertSuggestClass('Clz',
131 relevance: DART_RELEVANCE_DEFAULT,
132 kind: CompletionSuggestionKind.IDENTIFIER);
133 assertSuggestFunctionTypeAlias('F2', null, false, DART_RELEVANCE_DEFAULT,
134 CompletionSuggestionKind.IDENTIFIER);
135 assertNotSuggested('C');
136 assertNotSuggested('D');
137 assertNotSuggested('X');
138 assertNotSuggested('Object');
139 });
140 }
141 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698