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

Unified Diff: pkg/analysis_server/test/services/completion/completion_test_util.dart

Issue 862803008: fix completion in for statement (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: merge Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analysis_server/test/services/completion/completion_test_util.dart
diff --git a/pkg/analysis_server/test/services/completion/completion_test_util.dart b/pkg/analysis_server/test/services/completion/completion_test_util.dart
index 6a19a2ea9b1064b0b3495fb28327c5316d22f84e..2764b5877e8ce56240016cc530e584775acdba85 100644
--- a/pkg/analysis_server/test/services/completion/completion_test_util.dart
+++ b/pkg/analysis_server/test/services/completion/completion_test_util.dart
@@ -1853,6 +1853,7 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
return computeFull((bool result) {
expect(request.replacementOffset, completionOffset);
expect(request.replacementLength, 0);
+ assertSuggestParameter('args', null);
assertSuggestLocalVariable('foo', 'int');
assertSuggestImportedClass('Object');
});
@@ -1865,11 +1866,62 @@ abstract class AbstractSelectorSuggestionTest extends AbstractCompletionTest {
return computeFull((bool result) {
expect(request.replacementOffset, completionOffset);
expect(request.replacementLength, 0);
+ assertSuggestParameter('args', null);
assertSuggestLocalVariable('foo', null);
assertSuggestImportedClass('Object');
});
}
+ test_ForEachStatement_iterable() {
+ // SimpleIdentifier ForEachStatement Block
+ addTestSource('main(args) {for (int foo in ^) {}}');
+ computeFast();
+ return computeFull((bool result) {
+ expect(request.replacementOffset, completionOffset);
+ expect(request.replacementLength, 0);
+ assertSuggestParameter('args', null);
+ assertSuggestImportedClass('Object');
+ });
+ }
+
+ test_ForEachStatement_loopVariable() {
+ // SimpleIdentifier ForEachStatement Block
+ addTestSource('main(args) {for (^ in args) {}}');
+ computeFast();
+ return computeFull((bool result) {
+ expect(request.replacementOffset, completionOffset);
+ expect(request.replacementLength, 0);
+ assertNotSuggested('args');
+ assertSuggestImportedClass('String');
+ });
+ }
+
+ test_ForEachStatement_loopVariable_type() {
+ // SimpleIdentifier ForEachStatement Block
+ addTestSource('main(args) {for (^ foo in args) {}}');
+ computeFast();
+ return computeFull((bool result) {
+ expect(request.replacementOffset, completionOffset);
+ expect(request.replacementLength, 0);
+ assertNotSuggested('args');
+ assertNotSuggested('foo');
+ assertSuggestImportedClass('String');
+ });
+ }
+
+ test_ForEachStatement_loopVariable_type2() {
+ // DeclaredIdentifier ForEachStatement Block
+ addTestSource('main(args) {for (S^ foo in args) {}}');
+ computeFast();
+ return computeFull((bool result) {
+ expect(request.replacementOffset, completionOffset - 1);
+ expect(request.replacementLength, 1);
+ assertNotSuggested('args');
+ assertNotSuggested('foo');
+ assertSuggestImportedClass('String');
+ });
+ }
+
test_FormalParameterList() {
// FormalParameterList MethodDeclaration
addTestSource('''

Powered by Google App Engine
This is Rietveld 408576698