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

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

Issue 645573004: fix suggestions in class body and more common tests (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.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 show Element, 9 import 'package:analysis_server/src/protocol.dart' as protocol show Element,
10 ElementKind; 10 ElementKind;
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 // Library prefix should only be suggested by ImportedComputer 151 // Library prefix should only be suggested by ImportedComputer
152 if (computer is ImportedComputer) { 152 if (computer is ImportedComputer) {
153 CompletionSuggestion cs = 153 CompletionSuggestion cs =
154 assertSuggest(CompletionSuggestionKind.LIBRARY_PREFIX, prefix, relevan ce); 154 assertSuggest(CompletionSuggestionKind.LIBRARY_PREFIX, prefix, relevan ce);
155 protocol.Element element = cs.element; 155 protocol.Element element = cs.element;
156 expect(element, isNotNull); 156 expect(element, isNotNull);
157 expect(element.kind, equals(protocol.ElementKind.LIBRARY)); 157 expect(element.kind, equals(protocol.ElementKind.LIBRARY));
158 expect(element.returnType, isNull); 158 expect(element.returnType, isNull);
159 return cs; 159 return cs;
160 } else { 160 } else {
161 return null; 161 return assertNotSuggested(prefix);
162 } 162 }
163 } 163 }
164 164
165 CompletionSuggestion assertSuggestLocalVariable(String name, 165 CompletionSuggestion assertSuggestLocalVariable(String name,
166 String returnType, [CompletionRelevance relevance = 166 String returnType, [CompletionRelevance relevance =
167 CompletionRelevance.DEFAULT]) { 167 CompletionRelevance.DEFAULT]) {
168 // Local variables should only be suggested by LocalComputer 168 // Local variables should only be suggested by LocalComputer
169 if (computer is LocalComputer) { 169 if (computer is LocalComputer) {
170 CompletionSuggestion cs = 170 CompletionSuggestion cs =
171 assertSuggest(CompletionSuggestionKind.LOCAL_VARIABLE, name, relevance ); 171 assertSuggest(CompletionSuggestionKind.LOCAL_VARIABLE, name, relevance );
172 expect(cs.returnType, equals(returnType)); 172 expect(cs.returnType, equals(returnType));
173 protocol.Element element = cs.element; 173 protocol.Element element = cs.element;
174 expect(element, isNotNull); 174 expect(element, isNotNull);
175 expect(element.kind, equals(protocol.ElementKind.LOCAL_VARIABLE)); 175 expect(element.kind, equals(protocol.ElementKind.LOCAL_VARIABLE));
176 expect(element.name, equals(name)); 176 expect(element.name, equals(name));
177 expect( 177 expect(
178 element.returnType, 178 element.returnType,
179 equals(returnType != null ? returnType : 'dynamic')); 179 equals(returnType != null ? returnType : 'dynamic'));
180 return cs; 180 return cs;
181 } else { 181 } else {
182 return null; 182 return assertNotSuggested(name);
183 } 183 }
184 } 184 }
185 185
186 CompletionSuggestion assertSuggestMethod(String name, String declaringType, 186 CompletionSuggestion assertSuggestMethod(String name, String declaringType,
187 String returnType, [CompletionRelevance relevance = 187 String returnType, [CompletionRelevance relevance =
188 CompletionRelevance.DEFAULT]) { 188 CompletionRelevance.DEFAULT]) {
189 CompletionSuggestion cs = 189 CompletionSuggestion cs =
190 assertSuggest(CompletionSuggestionKind.METHOD, name, relevance); 190 assertSuggest(CompletionSuggestionKind.METHOD, name, relevance);
191 expect(cs.declaringType, equals(declaringType)); 191 expect(cs.declaringType, equals(declaringType));
192 expect(cs.returnType, equals(returnType)); 192 expect(cs.returnType, equals(returnType));
(...skipping 13 matching lines...) Expand all
206 if (computer is InvocationComputer) { 206 if (computer is InvocationComputer) {
207 CompletionSuggestion cs = 207 CompletionSuggestion cs =
208 assertSuggest(CompletionSuggestionKind.CONSTRUCTOR, name, relevance); 208 assertSuggest(CompletionSuggestionKind.CONSTRUCTOR, name, relevance);
209 protocol.Element element = cs.element; 209 protocol.Element element = cs.element;
210 expect(element, isNotNull); 210 expect(element, isNotNull);
211 expect(element.kind, equals(protocol.ElementKind.CONSTRUCTOR)); 211 expect(element.kind, equals(protocol.ElementKind.CONSTRUCTOR));
212 expect(element.name, equals(name)); 212 expect(element.name, equals(name));
213 expect(element.returnType, equals(returnType)); 213 expect(element.returnType, equals(returnType));
214 return cs; 214 return cs;
215 } else { 215 } else {
216 return null; 216 return assertNotSuggested(name);
217 } 217 }
218 } 218 }
219 219
220 CompletionSuggestion assertSuggestParameter(String name, String returnType, 220 CompletionSuggestion assertSuggestParameter(String name, String returnType,
221 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) { 221 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
222 CompletionSuggestion cs = 222 // Parameters should only be suggested by LocalComputer
223 assertSuggest(CompletionSuggestionKind.PARAMETER, name, relevance); 223 if (computer is LocalComputer) {
224 expect(cs.returnType, equals(returnType)); 224 CompletionSuggestion cs =
225 protocol.Element element = cs.element; 225 assertSuggest(CompletionSuggestionKind.PARAMETER, name, relevance);
226 expect(element, isNotNull); 226 expect(cs.returnType, equals(returnType));
227 expect(element.kind, equals(protocol.ElementKind.PARAMETER)); 227 protocol.Element element = cs.element;
228 expect(element.name, equals(name)); 228 expect(element, isNotNull);
229 expect( 229 expect(element.kind, equals(protocol.ElementKind.PARAMETER));
230 element.returnType, 230 expect(element.name, equals(name));
231 equals(returnType != null ? returnType : 'dynamic')); 231 expect(
232 return cs; 232 element.returnType,
233 equals(returnType != null ? returnType : 'dynamic'));
234 return cs;
235 } else {
236 return assertNotSuggested(name);
237 }
233 } 238 }
234 239
235 CompletionSuggestion assertSuggestSetter(String name, 240 CompletionSuggestion assertSuggestSetter(String name,
236 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) { 241 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
237 CompletionSuggestion cs = 242 CompletionSuggestion cs =
238 assertSuggest(CompletionSuggestionKind.SETTER, name, relevance); 243 assertSuggest(CompletionSuggestionKind.SETTER, name, relevance);
239 protocol.Element element = cs.element; 244 protocol.Element element = cs.element;
240 expect(element, isNotNull); 245 expect(element, isNotNull);
241 expect(element.kind, equals(protocol.ElementKind.SETTER)); 246 expect(element.kind, equals(protocol.ElementKind.SETTER));
242 expect(element.name, equals(name)); 247 expect(element.name, equals(name));
(...skipping 12 matching lines...) Expand all
255 expect(element.name, equals(name)); 260 expect(element.name, equals(name));
256 //TODO (danrubel) return type level variable 'type' but not as 'returnType' 261 //TODO (danrubel) return type level variable 'type' but not as 'returnType'
257 // expect( 262 // expect(
258 // element.returnType, 263 // element.returnType,
259 // equals(returnType != null ? returnType : 'dynamic')); 264 // equals(returnType != null ? returnType : 'dynamic'));
260 return cs; 265 return cs;
261 } 266 }
262 267
263 void assertSuggestTopLevelVarGetterSetter(String name, String returnType, 268 void assertSuggestTopLevelVarGetterSetter(String name, String returnType,
264 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) { 269 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
265 assertSuggestGetter(name, returnType); 270 if (computer is ImportedComputer) {
266 assertSuggestSetter(name); 271 assertSuggestGetter(name, returnType);
272 assertSuggestSetter(name);
273 } else {
274 assertNotSuggested(name);
275 }
267 } 276 }
268 277
269 bool computeFast() { 278 bool computeFast() {
270 _computeFastCalled = true; 279 _computeFastCalled = true;
271 testUnit = context.parseCompilationUnit(testSource); 280 testUnit = context.parseCompilationUnit(testSource);
272 completionNode = 281 completionNode =
273 new NodeLocator.con1(completionOffset).searchWithin(testUnit); 282 new NodeLocator.con1(completionOffset).searchWithin(testUnit);
274 request.unit = testUnit; 283 request.unit = testUnit;
275 request.node = completionNode; 284 request.node = completionNode;
276 return computer.computeFast(request); 285 return computer.computeFast(request);
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 464
456 CompletionSuggestion assertSuggestLocalClass(String name, 465 CompletionSuggestion assertSuggestLocalClass(String name,
457 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) { 466 [CompletionRelevance relevance = CompletionRelevance.DEFAULT]) {
458 if (computer is LocalComputer) { 467 if (computer is LocalComputer) {
459 return assertSuggestClass(name, relevance); 468 return assertSuggestClass(name, relevance);
460 } else { 469 } else {
461 return assertNotSuggested(name); 470 return assertNotSuggested(name);
462 } 471 }
463 } 472 }
464 473
474 CompletionSuggestion assertSuggestLocalFunction(String name,
475 String returnType, [bool isDeprecated = false, CompletionRelevance relevan ce =
476 CompletionRelevance.DEFAULT]) {
477 if (computer is LocalComputer) {
478 return assertSuggestFunction(name, returnType, isDeprecated, relevance);
479 } else {
480 return assertNotSuggested(name);
481 }
482 }
483
465 CompletionSuggestion assertSuggestLocalMethod(String name, 484 CompletionSuggestion assertSuggestLocalMethod(String name,
466 String declaringType, String returnType, [CompletionRelevance relevance = 485 String declaringType, String returnType, [CompletionRelevance relevance =
467 CompletionRelevance.DEFAULT]) { 486 CompletionRelevance.DEFAULT]) {
468 if (computer is LocalComputer) { 487 if (computer is LocalComputer) {
469 return assertSuggestMethod(name, declaringType, returnType, relevance); 488 return assertSuggestMethod(name, declaringType, returnType, relevance);
470 } else { 489 } else {
471 return assertNotSuggested(name); 490 return assertNotSuggested(name);
472 } 491 }
473 } 492 }
474 493
494 CompletionSuggestion assertSuggestLocalTopLevelVar(String name,
495 String returnType, [CompletionRelevance relevance =
496 CompletionRelevance.DEFAULT]) {
497 if (computer is LocalComputer) {
498 return assertSuggestTopLevelVar(name, returnType, relevance);
499 } else {
500 return assertNotSuggested(name);
501 }
502 }
503
504 test_BinaryExpression_LHS() {
505 // SimpleIdentifier BinaryExpression VariableDeclaration
506 // VariableDeclarationList VariableDeclarationStatement
507 addTestSource('main() {int a = 1, b = ^ + 2;}');
508 computeFast();
509 return computeFull(true).then((_) {
510 assertSuggestLocalVariable('a', 'int');
511 assertSuggestImportedClass('Object');
512 assertNotSuggested('b');
513 });
514 }
515
516 test_BinaryExpression_RHS() {
517 // SimpleIdentifier BinaryExpression VariableDeclaration
518 // VariableDeclarationList VariableDeclarationStatement
519 addTestSource('main() {int a = 1, b = 2 + ^;}');
520 computeFast();
521 return computeFull(true).then((_) {
522 assertSuggestLocalVariable('a', 'int');
523 assertSuggestImportedClass('Object');
524 assertNotSuggested('b');
525 });
526 }
527
475 test_Block() { 528 test_Block() {
476 // Block BlockFunctionBody MethodDeclaration 529 // Block BlockFunctionBody MethodDeclaration
477 addSource('/testAB.dart', ''' 530 addSource('/testAB.dart', '''
531 export "dart:math" hide max;
478 class A {int x;} 532 class A {int x;}
533 @deprecated D1() {int x;}
479 class _B { }'''); 534 class _B { }''');
480 addSource('/testCD.dart', ''' 535 addSource('/testCD.dart', '''
536 String T1;
537 var _T2;
481 class C { } 538 class C { }
482 class D { }'''); 539 class D { }''');
483 addSource('/testEEF.dart', ''' 540 addSource('/testEEF.dart', '''
484 class EE { } 541 class EE { }
485 class F { }'''); 542 class F { }''');
486 addSource('/testG.dart', 'class G { }'); 543 addSource('/testG.dart', 'class G { }');
487 addSource('/testH.dart', 'class H { }'); // not imported 544 addSource('/testH.dart', '''
545 class H { }
546 int T3;
547 var _T4;'''); // not imported
488 addTestSource(''' 548 addTestSource('''
489 import "/testAB.dart"; 549 import "/testAB.dart";
490 import "/testCD.dart" hide D; 550 import "/testCD.dart" hide D;
491 import "/testEEF.dart" show EE; 551 import "/testEEF.dart" show EE;
492 import "/testG.dart" as g; 552 import "/testG.dart" as g;
553 int T5;
554 var _T6;
555 Z D2() {int x;}
493 class X {a() {var f; {var x;} ^ var r;} Z b() { }} 556 class X {a() {var f; {var x;} ^ var r;} Z b() { }}
494 class Z { }'''); 557 class Z { }''');
495 computeFast(); 558 computeFast();
496 return computeFull(true).then((_) { 559 return computeFull(true).then((_) {
497 560
498 assertSuggestLocalClass('X'); 561 assertSuggestLocalClass('X');
499 assertSuggestLocalClass('Z'); 562 assertSuggestLocalClass('Z');
500 assertLocalSuggestMethod('a', 'X', null); 563 assertLocalSuggestMethod('a', 'X', null);
501 assertLocalSuggestMethod('b', 'X', 'Z'); 564 assertLocalSuggestMethod('b', 'X', 'Z');
502 assertSuggestLocalVariable('f', null); 565 assertSuggestLocalVariable('f', null);
503 // Don't suggest locals out of scope 566 // Don't suggest locals out of scope
504 assertNotSuggested('r'); 567 assertNotSuggested('r');
505 assertNotSuggested('x'); 568 assertNotSuggested('x');
506 569
507 assertSuggestImportedClass('A'); 570 assertSuggestImportedClass('A');
508 assertNotSuggested('_B'); 571 assertNotSuggested('_B');
509 assertSuggestImportedClass('C'); 572 assertSuggestImportedClass('C');
510 // hidden element suggested as low relevance 573 // hidden element suggested as low relevance
511 assertSuggestImportedClass('D', CompletionRelevance.LOW); 574 assertSuggestImportedClass('D', CompletionRelevance.LOW);
575 assertSuggestImportedFunction('D1', null, true);
576 assertSuggestLocalFunction('D2', 'Z');
512 assertSuggestImportedClass('EE'); 577 assertSuggestImportedClass('EE');
513 // hidden element suggested as low relevance 578 // hidden element suggested as low relevance
514 assertSuggestImportedClass('F', CompletionRelevance.LOW); 579 assertSuggestImportedClass('F', CompletionRelevance.LOW);
515 assertSuggestLibraryPrefix('g'); 580 assertSuggestLibraryPrefix('g');
516 assertNotSuggested('G'); 581 assertNotSuggested('G');
517 assertSuggestImportedClass('H', CompletionRelevance.LOW); 582 assertSuggestImportedClass('H', CompletionRelevance.LOW);
518 assertSuggestImportedClass('Object'); 583 assertSuggestImportedClass('Object');
584 assertSuggestImportedFunction('min', 'num', false);
585 assertSuggestImportedFunction(
586 'max',
587 'num',
588 false,
589 CompletionRelevance.LOW);
590 assertSuggestTopLevelVarGetterSetter('T1', 'String');
591 assertNotSuggested('_T2');
592 assertSuggestImportedTopLevelVar('T3', 'int', CompletionRelevance.LOW);
593 assertNotSuggested('_T4');
594 assertSuggestLocalTopLevelVar('T5', 'int');
595 assertSuggestLocalTopLevelVar('_T6', null);
519 // TODO (danrubel) suggest HtmlElement as low relevance 596 // TODO (danrubel) suggest HtmlElement as low relevance
520 assertNotSuggested('HtmlElement'); 597 assertNotSuggested('HtmlElement');
521 }); 598 });
522 } 599 }
523 600
524 test_CascadeExpression_selector1() { 601 test_CascadeExpression_selector1() {
525 // PropertyAccess CascadeExpression ExpressionStatement Block 602 // PropertyAccess CascadeExpression ExpressionStatement Block
526 addSource('/testB.dart', ''' 603 addSource('/testB.dart', '''
527 class B { }'''); 604 class B { }''');
528 addTestSource(''' 605 addTestSource('''
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 return computeFull(true).then((_) { 652 return computeFull(true).then((_) {
576 assertNotSuggested('b'); 653 assertNotSuggested('b');
577 assertNotSuggested('_c'); 654 assertNotSuggested('_c');
578 assertSuggestLocalVariable('a', 'A'); 655 assertSuggestLocalVariable('a', 'A');
579 assertSuggestLocalClass('A'); 656 assertSuggestLocalClass('A');
580 assertSuggestLocalClass('X'); 657 assertSuggestLocalClass('X');
581 assertSuggestImportedClass('Object'); 658 assertSuggestImportedClass('Object');
582 }); 659 });
583 } 660 }
584 661
662 test_CatchClause_typed() {
663 // Block CatchClause TryStatement
664 addTestSource('class A {a() {try{var x;} on E catch (e) {^}}}');
665 computeFast();
666 return computeFull(true).then((_) {
667 assertSuggestParameter('e', 'E');
668 assertSuggestLocalMethod('a', 'A', null);
669 assertSuggestImportedClass('Object');
670 assertNotSuggested('x');
671 });
672 }
673
674 test_CatchClause_untyped() {
675 // Block CatchClause TryStatement
676 addTestSource('class A {a() {try{var x;} catch (e, s) {^}}}');
677 computeFast();
678 return computeFull(true).then((_) {
679 assertSuggestParameter('e', null);
680 assertSuggestParameter('s', 'StackTrace');
681 assertSuggestLocalMethod('a', 'A', null);
682 assertSuggestImportedClass('Object');
683 assertNotSuggested('x');
684 });
685 }
686
687 test_ClassDeclaration_body() {
688 // ClassDeclaration CompilationUnit
689 addSource('/testB.dart', '''
690 class B { }''');
691 addTestSource( //
692 'import "testB.dart" as x;' //
693 ' @deprecated class A {^}' //
694 ' class _B {}' //
695 ' A T;');
696 computeFast();
697 return computeFull(true).then((_) {
698 CompletionSuggestion suggestionA = assertSuggestLocalClass('A');
699 if (suggestionA != null) {
700 expect(suggestionA.element.isDeprecated, isTrue);
701 expect(suggestionA.element.isPrivate, isFalse);
702 }
703 CompletionSuggestion suggestionB = assertSuggestLocalClass('_B');
704 if (suggestionB != null) {
705 expect(suggestionB.element.isDeprecated, isFalse);
706 expect(suggestionB.element.isPrivate, isTrue);
707 }
708 CompletionSuggestion suggestionO = assertSuggestImportedClass('Object');
709 if (suggestionO != null) {
710 expect(suggestionO.element.isDeprecated, isFalse);
711 expect(suggestionO.element.isPrivate, isFalse);
712 }
713 assertSuggestLocalTopLevelVar('T', 'A');
714 assertSuggestLibraryPrefix('x');
715 });
716 }
717
585 test_Combinator_hide() { 718 test_Combinator_hide() {
586 // SimpleIdentifier HideCombinator ImportDirective 719 // SimpleIdentifier HideCombinator ImportDirective
587 addSource('/testAB.dart', ''' 720 addSource('/testAB.dart', '''
588 library libAB; 721 library libAB;
589 part '/partAB.dart'; 722 part '/partAB.dart';
590 class A { } 723 class A { }
591 class B { }'''); 724 class B { }''');
592 addSource('/partAB.dart', ''' 725 addSource('/partAB.dart', '''
593 part of libAB; 726 part of libAB;
594 var T1; 727 var T1;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
683 return computeFull(true).then((_) { 816 return computeFull(true).then((_) {
684 assertSuggestNamedConstructor('c', 'X'); 817 assertSuggestNamedConstructor('c', 'X');
685 assertSuggestNamedConstructor('_d', 'X'); 818 assertSuggestNamedConstructor('_d', 'X');
686 assertNotSuggested('F1'); 819 assertNotSuggested('F1');
687 assertNotSuggested('T1'); 820 assertNotSuggested('T1');
688 assertNotSuggested('z'); 821 assertNotSuggested('z');
689 assertNotSuggested('m'); 822 assertNotSuggested('m');
690 }); 823 });
691 } 824 }
692 825
826 test_ExpressionStatement_identifier() {
827 // SimpleIdentifier ExpressionStatement Block
828 addSource('/testA.dart', '''
829 _B F1() { }
830 class A {int x;}
831 class _B { }''');
832 addTestSource('''
833 import "/testA.dart";
834 class C {foo(){O^}}''');
835 computeFast();
836 return computeFull(true).then((_) {
837 assertSuggestImportedClass('A');
838 assertSuggestImportedFunction('F1', '_B', false);
839 assertSuggestLocalClass('C');
840 assertNotSuggested('x');
841 assertNotSuggested('_B');
842 });
843 }
844
845 test_ExpressionStatement_name() {
846 // ExpressionStatement Block BlockFunctionBody MethodDeclaration
847 addSource('/testA.dart', '''
848 B T1;
849 class B{}''');
850 addTestSource('''
851 import "/testA.dart";
852 class C {a() {C ^}}''');
853 computeFast();
854 return computeFull(true).then((_) {
855 assertNoSuggestions();
856 });
857 }
858
859 test_FieldDeclaration_name_typed() {
860 // SimpleIdentifier VariableDeclaration VariableDeclarationList
861 // FieldDeclaration
862 addSource('/testA.dart', 'class A { }');
863 addTestSource('''
864 import "/testA.dart";
865 class C {A ^}''');
866 computeFast();
867 return computeFull(true).then((_) {
868 assertNoSuggestions();
869 });
870 }
871
872 test_FieldDeclaration_name_var() {
873 // SimpleIdentifier VariableDeclaration VariableDeclarationList
874 // FieldDeclaration
875 addSource('/testA.dart', 'class A { }');
876 addTestSource('''
877 import "/testA.dart";
878 class C {var ^}''');
879 computeFast();
880 return computeFull(true).then((_) {
881 assertNoSuggestions();
882 });
883 }
884
693 test_ImportDirective_dart() { 885 test_ImportDirective_dart() {
694 // SimpleStringLiteral ImportDirective 886 // SimpleStringLiteral ImportDirective
695 addTestSource(''' 887 addTestSource('''
696 import "dart^"; 888 import "dart^";
697 main() {}'''); 889 main() {}''');
698 computeFast(); 890 computeFast();
699 return computeFull(true).then((_) { 891 return computeFull(true).then((_) {
700 assertNoSuggestions(); 892 assertNoSuggestions();
701 }); 893 });
702 } 894 }
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
971 class X {X.c(); X._d(); z() {}}'''); 1163 class X {X.c(); X._d(); z() {}}''');
972 addTestSource(''' 1164 addTestSource('''
973 import "/testB.dart"; 1165 import "/testB.dart";
974 class Y {Y.c(); Y._d(); z() {}} 1166 class Y {Y.c(); Y._d(); z() {}}
975 main() {var ^}'''); 1167 main() {var ^}''');
976 computeFast(); 1168 computeFast();
977 return computeFull(true).then((_) { 1169 return computeFull(true).then((_) {
978 assertNoSuggestions(); 1170 assertNoSuggestions();
979 }); 1171 });
980 } 1172 }
981
982 test_BinaryExpression_LHS() {
983 // SimpleIdentifier BinaryExpression VariableDeclaration
984 // VariableDeclarationList VariableDeclarationStatement
985 addTestSource('main() {int a = 1, b = ^ + 2;}');
986 computeFast();
987 return computeFull(true).then((_) {
988 assertSuggestLocalVariable('a', 'int');
989 assertSuggestImportedClass('Object');
990 assertNotSuggested('b');
991 });
992 }
993
994 test_BinaryExpression_RHS() {
995 // SimpleIdentifier BinaryExpression VariableDeclaration
996 // VariableDeclarationList VariableDeclarationStatement
997 addTestSource('main() {int a = 1, b = 2 + ^;}');
998 computeFast();
999 return computeFull(true).then((_) {
1000 assertSuggestLocalVariable('a', 'int');
1001 assertSuggestImportedClass('Object');
1002 assertNotSuggested('b');
1003 });
1004 }
1005 } 1173 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698