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

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

Issue 558893002: add code completion declared and return types (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge and remove reference to analysis engine Created 6 years, 3 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.toplevel; 5 library test.services.completion.toplevel;
6 6
7 import 'package:analysis_server/src/protocol.dart'; 7 import 'package:analysis_server/src/protocol.dart';
8 import 'package:analysis_server/src/services/completion/imported_computer.dart'; 8 import 'package:analysis_server/src/services/completion/imported_computer.dart';
9 import '../../reflective_tests.dart'; 9 import '../../reflective_tests.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
140 140
141 test_field_name2() { 141 test_field_name2() {
142 addSource('/testA.dart', 'class A { }'); 142 addSource('/testA.dart', 'class A { }');
143 addTestSource('import "/testA.dart"; class C {var ^}'); 143 addTestSource('import "/testA.dart"; class C {var ^}');
144 return computeFull().then((_) { 144 return computeFull().then((_) {
145 assertNotSuggested('A'); 145 assertNotSuggested('A');
146 }); 146 });
147 } 147 }
148 148
149 test_local_name() { 149 test_local_name() {
150 addSource('/testA.dart', 'var T1;'); 150 addSource('/testA.dart', 'B T1; class B{}');
151 addTestSource('import "/testA.dart"; class C {a() {C ^}}'); 151 addTestSource('import "/testA.dart"; class C {a() {C ^}}');
152 return computeFull().then((_) { 152 return computeFull().then((_) {
153 //TODO (danrubel) should not be suggested 153 assertNotSuggested('T1');
154 // but C ^ in this test
155 // parses differently than var ^ in test below
156 assertSuggestTopLevelVar('T1');
157 }); 154 });
158 } 155 }
159 156
160 test_local_name2() { 157 test_local_name2() {
161 addSource('/testA.dart', 'var T1;'); 158 addSource('/testA.dart', 'var T1;');
162 addTestSource('import "/testA.dart"; class C {a() {var ^}}'); 159 addTestSource('import "/testA.dart"; class C {a() {var ^}}');
163 return computeFull().then((_) { 160 return computeFull().then((_) {
164 assertNotSuggested('T1'); 161 assertNotSuggested('T1');
165 }); 162 });
166 } 163 }
167 164
168 test_topLevelVar() { 165 test_topLevelVar() {
169 addSource('/testA.dart', 'var T1; var _T2;'); 166 addSource('/testA.dart', 'String T1; var _T2;');
170 addTestSource('import "/testA.dart"; class C {foo(){^}}'); 167 addTestSource('import "/testA.dart"; class C {foo(){^}}');
171 return computeFull().then((_) { 168 return computeFull().then((_) {
172 assertSuggestTopLevelVar('T1'); 169 assertSuggestTopLevelVar('T1', 'String');
173 assertNotSuggested('_T2'); 170 assertNotSuggested('_T2');
174 }); 171 });
175 } 172 }
176 173
177 test_topLevelVar_name() { 174 test_topLevelVar_name() {
178 addSource('/testA.dart', 'class B { };'); 175 addSource('/testA.dart', 'class B { };');
179 addTestSource('import "/testA.dart"; class C {} B ^'); 176 addTestSource('import "/testA.dart"; class C {} B ^');
180 return computeFull().then((_) { 177 return computeFull().then((_) {
181 assertNotSuggested('B'); 178 assertNotSuggested('B');
182 }); 179 });
183 } 180 }
184 181
185 test_topLevelVar_name2() { 182 test_topLevelVar_name2() {
186 addSource('/testA.dart', 'class B { };'); 183 addSource('/testA.dart', 'class B { };');
187 addTestSource('import "/testA.dart"; class C {} var ^'); 184 addTestSource('import "/testA.dart"; class C {} var ^');
188 return computeFull().then((_) { 185 return computeFull().then((_) {
189 assertNotSuggested('B'); 186 assertNotSuggested('B');
190 }); 187 });
191 } 188 }
192 189
193 test_topLevelVar_notImported() { 190 test_topLevelVar_notImported() {
194 addSource('/testA.dart', 'var T1; var _T2;'); 191 addSource('/testA.dart', 'var T1; var _T2;');
195 addTestSource('class C {foo(){^}}'); 192 addTestSource('class C {foo(){^}}');
196 return computeFull(true).then((_) { 193 return computeFull(true).then((_) {
197 assertSuggestTopLevelVar('T1', CompletionRelevance.LOW); 194 assertSuggestTopLevelVar('T1', null, CompletionRelevance.LOW);
198 assertNotSuggested('_T2'); 195 assertNotSuggested('_T2');
199 }); 196 });
200 } 197 }
201 } 198 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698