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

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

Issue 695773003: move import combinator suggestions into a separate computer (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 1 month 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
(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/src/protocol.dart';
8 import 'package:analysis_server/src/services/completion/combinator_computer.dart ';
9 import 'package:unittest/unittest.dart';
10
11 import '../../reflective_tests.dart';
12 import 'completion_test_util.dart';
13
14 main() {
15 groupSep = ' | ';
16 runReflectiveTests(CombinatorComputerTest);
17 }
18
19 @ReflectiveTestCase()
20 class CombinatorComputerTest extends AbstractCompletionTest {
21
22 @override
23 void setUp() {
24 super.setUp();
25 computer = new CombinatorComputer();
26 }
27
28 test_Block_inherited_local() {
29 // Block BlockFunctionBody MethodDeclaration ClassDeclaration
30 addTestSource('''
31 class F { var f1; f2() { } }
32 class E extends F { var e1; e2() { } }
33 class I { int i1; i2() { } }
34 class M { var m1; int m2() { } }
35 class A extends E implements I with M {a() {^}}''');
36 computeFast();
37 return computeFull(true).then((_) {
38 assertNoSuggestions();
39 });
40 }
41
42 test_Combinator_hide() {
43 // SimpleIdentifier HideCombinator ImportDirective
44 addSource('/testAB.dart', '''
45 library libAB;
46 part '/partAB.dart';
47 class A { }
48 class B { }''');
49 addSource('/partAB.dart', '''
50 part of libAB;
51 var T1;
52 PB F1() => new PB();
53 class PB { }''');
54 addSource('/testCD.dart', '''
55 class C { }
56 class D { }''');
57 addTestSource('''
58 import "/testAB.dart" hide ^;
59 import "/testCD.dart";
60 class X {}''');
61 computeFast();
62 return computeFull(true).then((_) {
63 assertSuggestClass(
64 'A',
65 CompletionRelevance.DEFAULT,
66 CompletionSuggestionKind.IDENTIFIER);
67 assertSuggestClass(
68 'B',
69 CompletionRelevance.DEFAULT,
70 CompletionSuggestionKind.IDENTIFIER);
71 assertSuggestClass(
72 'PB',
73 CompletionRelevance.DEFAULT,
74 CompletionSuggestionKind.IDENTIFIER);
75 assertSuggestTopLevelVar(
76 'T1',
77 null,
78 CompletionRelevance.DEFAULT,
79 CompletionSuggestionKind.IDENTIFIER);
80 assertSuggestFunction(
81 'F1',
82 'PB',
83 false,
84 CompletionRelevance.DEFAULT,
85 CompletionSuggestionKind.IDENTIFIER);
86 assertNotSuggested('C');
87 assertNotSuggested('D');
88 assertNotSuggested('X');
89 assertNotSuggested('Object');
90 });
91 }
92
93 test_Combinator_show() {
94 // SimpleIdentifier HideCombinator ImportDirective
95 addSource('/testAB.dart', '''
96 library libAB;
97 part '/partAB.dart';
98 class A { }
99 class B { }''');
100 addSource('/partAB.dart', '''
101 part of libAB;
102 var T1;
103 PB F1() => new PB();
104 typedef PB2 F2(int blat);
105 class Clz = Object with Object;
106 class PB { }''');
107 addSource('/testCD.dart', '''
108 class C { }
109 class D { }''');
110 addTestSource('''
111 import "/testAB.dart" show ^;
112 import "/testCD.dart";
113 class X {}''');
114 computeFast();
115 return computeFull(true).then((_) {
116 assertSuggestClass(
117 'A',
118 CompletionRelevance.DEFAULT,
119 CompletionSuggestionKind.IDENTIFIER);
120 assertSuggestClass(
121 'B',
122 CompletionRelevance.DEFAULT,
123 CompletionSuggestionKind.IDENTIFIER);
124 assertSuggestClass(
125 'PB',
126 CompletionRelevance.DEFAULT,
127 CompletionSuggestionKind.IDENTIFIER);
128 assertSuggestTopLevelVar(
129 'T1',
130 null,
131 CompletionRelevance.DEFAULT,
132 CompletionSuggestionKind.IDENTIFIER);
133 assertSuggestFunction(
134 'F1',
135 'PB',
136 false,
137 CompletionRelevance.DEFAULT,
138 CompletionSuggestionKind.IDENTIFIER);
139 assertSuggestClass(
140 'Clz',
141 CompletionRelevance.DEFAULT,
142 CompletionSuggestionKind.IDENTIFIER);
143 assertSuggestFunctionTypeAlias(
144 'F2',
145 null,
146 false,
147 CompletionRelevance.DEFAULT,
148 CompletionSuggestionKind.IDENTIFIER);
149 assertNotSuggested('C');
150 assertNotSuggested('D');
151 assertNotSuggested('X');
152 assertNotSuggested('Object');
153 });
154 }
155 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698