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

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

Issue 1503463002: move combinator contributor to new task model (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: remove old code Created 5 years 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/dart/completion_contributor_util.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
index 869ed882ef556cc5a02a59332214d36be8243373..9b200d9189eeda3e2c7a69ce613e1a0801289533 100644
--- a/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
+++ b/pkg/analysis_server/test/services/completion/dart/completion_contributor_util.dart
@@ -54,6 +54,13 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
testSource = addSource(testFile, content);
}
+ void assertHasNoParameterInfo(CompletionSuggestion suggestion) {
+ expect(suggestion.parameterNames, isNull);
+ expect(suggestion.parameterTypes, isNull);
+ expect(suggestion.requiredParameterCount, isNull);
+ expect(suggestion.hasNamedParameters, isNull);
+ }
+
void assertHasParameterInfo(CompletionSuggestion suggestion) {
expect(suggestion.parameterNames, isNotNull);
expect(suggestion.parameterTypes, isNotNull);
@@ -129,6 +136,101 @@ abstract class DartCompletionContributorTest extends AbstractContextTest {
return cs;
}
+ CompletionSuggestion assertSuggestClass(String name,
+ {int relevance: DART_RELEVANCE_DEFAULT,
+ String importUri,
+ CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
+ bool isDeprecated: false,
+ String elemFile,
+ int elemOffset}) {
+ CompletionSuggestion cs = assertSuggest(name,
+ csKind: kind,
+ relevance: relevance,
+ importUri: importUri,
+ isDeprecated: isDeprecated,
+ elemFile: elemFile,
+ elemOffset: elemOffset);
+ protocol.Element element = cs.element;
+ expect(element, isNotNull);
+ expect(element.kind, equals(protocol.ElementKind.CLASS));
+ expect(element.name, equals(name));
+ expect(element.parameters, isNull);
+ expect(element.returnType, isNull);
+ assertHasNoParameterInfo(cs);
+ return cs;
+ }
+
+ CompletionSuggestion assertSuggestFunction(String name, String returnType,
+ {CompletionSuggestionKind kind: CompletionSuggestionKind.INVOCATION,
+ bool deprecated: false,
+ int relevance: DART_RELEVANCE_DEFAULT,
+ String importUri}) {
+ CompletionSuggestion cs = assertSuggest(name,
+ csKind: kind,
+ relevance: relevance,
+ importUri: importUri,
+ isDeprecated: deprecated);
+ expect(cs.returnType, returnType != null ? returnType : 'dynamic');
+ protocol.Element element = cs.element;
+ expect(element, isNotNull);
+ expect(element.kind, equals(protocol.ElementKind.FUNCTION));
+ expect(element.name, equals(name));
+ expect(element.isDeprecated, equals(deprecated));
+ String param = element.parameters;
+ expect(param, isNotNull);
+ expect(param[0], equals('('));
+ expect(param[param.length - 1], equals(')'));
+ expect(element.returnType,
+ equals(returnType != null ? returnType : 'dynamic'));
+ assertHasParameterInfo(cs);
+ return cs;
+ }
+
+ CompletionSuggestion assertSuggestFunctionTypeAlias(
+ String name, String returnType, bool isDeprecated,
+ [int relevance = DART_RELEVANCE_DEFAULT,
+ CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
+ String importUri]) {
+ CompletionSuggestion cs = assertSuggest(name,
+ csKind: kind,
+ relevance: relevance,
+ importUri: importUri,
+ isDeprecated: isDeprecated);
+ expect(cs.returnType, returnType != null ? returnType : 'dynamic');
+ protocol.Element element = cs.element;
+ expect(element, isNotNull);
+ expect(element.kind, equals(protocol.ElementKind.FUNCTION_TYPE_ALIAS));
+ expect(element.name, equals(name));
+ expect(element.isDeprecated, equals(isDeprecated));
+ // TODO (danrubel) Determine why params are null
+ // String param = element.parameters;
+ // expect(param, isNotNull);
+ // expect(param[0], equals('('));
+ // expect(param[param.length - 1], equals(')'));
+ expect(element.returnType,
+ equals(returnType != null ? returnType : 'dynamic'));
+ // TODO (danrubel) Determine why param info is missing
+ // assertHasParameterInfo(cs);
+ return cs;
+ }
+
+ CompletionSuggestion assertSuggestTopLevelVar(String name, String returnType,
+ [int relevance = DART_RELEVANCE_DEFAULT,
+ CompletionSuggestionKind kind = CompletionSuggestionKind.INVOCATION,
+ String importUri]) {
+ CompletionSuggestion cs = assertSuggest(name,
+ csKind: kind, relevance: relevance, importUri: importUri);
+ expect(cs.returnType, returnType != null ? returnType : 'dynamic');
+ protocol.Element element = cs.element;
+ expect(element, isNotNull);
+ expect(element.kind, equals(protocol.ElementKind.TOP_LEVEL_VARIABLE));
+ expect(element.name, equals(name));
+ expect(element.parameters, isNull);
+ expect(element.returnType, returnType != null ? returnType : 'dynamic');
+ assertHasNoParameterInfo(cs);
+ return cs;
+ }
+
/**
* Return a [Future] that completes with the containing library information
* after it is accessible via [context.getLibrariesContaining].

Powered by Google App Engine
This is Rietveld 408576698