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

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

Issue 645733002: improve suggestions in for statement (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 864 matching lines...) Expand 10 before | Expand all | Expand 10 after
875 addSource('/testA.dart', 'class A { }'); 875 addSource('/testA.dart', 'class A { }');
876 addTestSource(''' 876 addTestSource('''
877 import "/testA.dart"; 877 import "/testA.dart";
878 class C {var ^}'''); 878 class C {var ^}''');
879 computeFast(); 879 computeFast();
880 return computeFull(true).then((_) { 880 return computeFull(true).then((_) {
881 assertNoSuggestions(); 881 assertNoSuggestions();
882 }); 882 });
883 } 883 }
884 884
885 test_ForEachStatement_body_typed() {
886 // Block ForEachStatement
887 addTestSource('main(args) {for (int foo in bar) {^}}');
888 computeFast();
889 return computeFull(true).then((_) {
890 assertSuggestLocalVariable('foo', 'int');
891 assertSuggestImportedClass('Object');
892 });
893 }
894
895 test_ForEachStatement_body_untyped() {
896 // Block ForEachStatement
897 addTestSource('main(args) {for (foo in bar) {^}}');
898 computeFast();
899 return computeFull(true).then((_) {
900 assertSuggestLocalVariable('foo', null);
901 assertSuggestImportedClass('Object');
902 });
903 }
904
905 test_ForStatement_body() {
906 // Block ForStatement
907 addTestSource('main(args) {for (int i; i < 10; ++i) {^}}');
908 computeFast();
909 return computeFull(true).then((_) {
910 assertSuggestLocalVariable('i', 'int');
911 assertSuggestImportedClass('Object');
912 });
913 }
914
915 test_ForStatement_condition() {
916 // SimpleIdentifier ForStatement
917 addTestSource('main() {for (int index = 0; i^)}');
918 computeFast();
919 return computeFull(true).then((_) {
920 assertSuggestLocalVariable('index', 'int');
921 });
922 }
923
924 test_ForStatement_initializer() {
925 // SimpleIdentifier ForStatement
926 addTestSource('main() {List a; for (^)}');
927 computeFast();
928 return computeFull(true).then((_) {
929 assertSuggestLocalVariable('a', 'List');
930 assertSuggestImportedClass('Object');
931 assertSuggestImportedClass('int');
932 });
933 }
934
935 test_ForStatement_updaters() {
936 // SimpleIdentifier ForStatement
937 addTestSource('main() {for (int index = 0; index < 10; i^)}');
938 computeFast();
939 return computeFull(true).then((_) {
940 assertSuggestLocalVariable('index', 'int');
941 });
942 }
943
944 test_ForStatement_updaters_prefix_expression() {
945 // SimpleIdentifier PrefixExpression ForStatement
946 addTestSource('main() {for (int index = 0; index < 10; ++i^)}');
947 computeFast();
948 return computeFull(true).then((_) {
949 assertSuggestLocalVariable('index', 'int');
950 });
951 }
952
885 test_ImportDirective_dart() { 953 test_ImportDirective_dart() {
886 // SimpleStringLiteral ImportDirective 954 // SimpleStringLiteral ImportDirective
887 addTestSource(''' 955 addTestSource('''
888 import "dart^"; 956 import "dart^";
889 main() {}'''); 957 main() {}''');
890 computeFast(); 958 computeFast();
891 return computeFull(true).then((_) { 959 return computeFull(true).then((_) {
892 assertNoSuggestions(); 960 assertNoSuggestions();
893 }); 961 });
894 } 962 }
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
1164 addTestSource(''' 1232 addTestSource('''
1165 import "/testB.dart"; 1233 import "/testB.dart";
1166 class Y {Y.c(); Y._d(); z() {}} 1234 class Y {Y.c(); Y._d(); z() {}}
1167 main() {var ^}'''); 1235 main() {var ^}''');
1168 computeFast(); 1236 computeFast();
1169 return computeFull(true).then((_) { 1237 return computeFull(true).then((_) {
1170 assertNoSuggestions(); 1238 assertNoSuggestions();
1171 }); 1239 });
1172 } 1240 }
1173 } 1241 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698