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

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

Issue 635043002: show only type names in is expression RHS (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 6 years, 2 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 'package:unittest/unittest.dart'; 9 import 'package:unittest/unittest.dart';
10 10
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 test_ImportDirective_dart() { 182 test_ImportDirective_dart() {
183 // SimpleStringLiteral ImportDirective 183 // SimpleStringLiteral ImportDirective
184 addTestSource(''' 184 addTestSource('''
185 import "dart^"; 185 import "dart^";
186 main() {}'''); 186 main() {}''');
187 return computeFull().then((_) { 187 return computeFull().then((_) {
188 assertNotSuggested('Object'); 188 assertNotSuggested('Object');
189 }); 189 });
190 } 190 }
191 191
192 test_IsExpression_local() {
193 // SimpleIdentifier TypeName IsExpression IfStatement
194 addTestSource('''
195 class X {X.c(); X._d(); z() {}}
196 main() {var x; if (x is ^) { }}''');
197 return computeFull().then((_) {
198 assertNoSuggestions();
199 });
200 }
201
202 test_PrefixedIdentifier() { 192 test_PrefixedIdentifier() {
203 // SimpleIdentifier PrefixedIdentifier ExpressionStatement 193 // SimpleIdentifier PrefixedIdentifier ExpressionStatement
204 addSource('/testA.dart', ''' 194 addSource('/testA.dart', '''
205 class A() {int x;} 195 class A() {int x;}
206 _B() {}'''); 196 _B() {}''');
207 addTestSource(''' 197 addTestSource('''
208 import "/testA.dart"; 198 import "/testA.dart";
209 class X {foo(){A a; a.^}}'''); 199 class X {foo(){A a; a.^}}''');
210 return computeFull().then((_) { 200 return computeFull().then((_) {
211 // InvocationComputer provides suggestions for prefixed expressions 201 // InvocationComputer provides suggestions for prefixed expressions
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 return computeFull().then((_) { 292 return computeFull().then((_) {
303 assertSuggestClass('A'); 293 assertSuggestClass('A');
304 assertNotSuggested('x'); 294 assertNotSuggested('x');
305 assertNotSuggested('B'); 295 assertNotSuggested('B');
306 // Should not suggest compilation unit elements 296 // Should not suggest compilation unit elements
307 // which are returned by the LocalComputer 297 // which are returned by the LocalComputer
308 assertNotSuggested('C'); 298 assertNotSuggested('C');
309 }); 299 });
310 } 300 }
311 301
312 xtest_IsExpression_imported() {
313 // SimpleIdentifier TypeName IsExpression IfStatement
314 addSource('/testB.dart', '''
315 lib B;
316 class X {X.c(); X._d(); z() {}}''');
317 addTestSource('''
318 import "/testB.dart";
319 main() {var x; if (x is ^) { }}''');
320 return computeFull().then((_) {
321 assertSuggestConstructor('c');
322 assertNotSuggested('main');
323 assertNotSuggested('X');
324 assertNotSuggested('B');
325 assertNotSuggested('x');
326 });
327 }
328
329 xtest_VariableDeclarationStatement_RHS() { 302 xtest_VariableDeclarationStatement_RHS() {
330 // SimpleIdentifier VariableDeclaration VariableDeclarationList 303 // SimpleIdentifier VariableDeclaration VariableDeclarationList
331 // VariableDeclarationStatement 304 // VariableDeclarationStatement
332 addSource('/testA.dart', 'class A {int x;} class _B { }'); 305 addSource('/testA.dart', 'class A {int x;} class _B { }');
333 addTestSource(''' 306 addTestSource('''
334 import "/testA.dart"; 307 import "/testA.dart";
335 class C {foo(){var e = ^}}'''); 308 class C {foo(){var e = ^}}''');
336 return computeFull().then((_) { 309 return computeFull().then((_) {
337 assertSuggestClass('A'); 310 assertSuggestClass('A');
338 assertNotSuggested('x'); 311 assertNotSuggested('x');
339 assertNotSuggested('_B'); 312 assertNotSuggested('_B');
340 // Should not suggest compilation unit elements 313 // Should not suggest compilation unit elements
341 // which are returned by the LocalComputer 314 // which are returned by the LocalComputer
342 assertNotSuggested('C'); 315 assertNotSuggested('C');
343 }); 316 });
344 } 317 }
345 } 318 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698