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

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

Issue 2313003002: Issue 27143. Fill documentation for local, AST based completion. (Closed)
Patch Set: Created 4 years, 3 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
index 8cbed55e7f9c835e9c50e44446f842ba07dd1477..004e262f8bc9e1ab9a8980ec10338294895b1bee 100644
--- a/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/local_reference_contributor_test.dart
@@ -1923,6 +1923,110 @@ class A {a(blat: ^) { }}''');
assertNotSuggested('bar');
}
+ test_doc_classMember() async {
+ String docLines = r'''
+ /// My documentation.
+ /// Short description.
+ ///
+ /// Longer description.
+''';
+ void assertDoc(CompletionSuggestion suggestion) {
+ expect(suggestion.docSummary, 'My documentation.\nShort description.');
+ expect(suggestion.docComplete,
+ 'My documentation.\nShort description.\n\nLonger description.');
+ }
+
+ addTestSource('''
+class C {
+$docLines
+ int myField;
+
+$docLines
+ myMethod() {}
+
+$docLines
+ int get myGetter => 0;
+
+ main() {^}
+}''');
+ await computeSuggestions();
+ {
+ CompletionSuggestion suggestion = assertSuggestField('myField', 'int',
+ relevance: DART_RELEVANCE_LOCAL_FIELD);
+ assertDoc(suggestion);
+ }
+ {
+ CompletionSuggestion suggestion = assertSuggestMethod(
+ 'myMethod', 'C', null,
+ relevance: DART_RELEVANCE_LOCAL_METHOD);
+ assertDoc(suggestion);
+ }
+ {
+ CompletionSuggestion suggestion = assertSuggestGetter('myGetter', 'int',
+ relevance: DART_RELEVANCE_LOCAL_ACCESSOR);
+ assertDoc(suggestion);
+ }
+ }
+
+ test_doc_topLevel() async {
+ String docLines = r'''
+/// My documentation.
+/// Short description.
+///
+/// Longer description.
+''';
+ void assertDoc(CompletionSuggestion suggestion) {
+ expect(suggestion.docSummary, 'My documentation.\nShort description.');
+ expect(suggestion.docComplete,
+ 'My documentation.\nShort description.\n\nLonger description.');
+ }
+
+ addTestSource('''
+$docLines
+class MyClass {}
+
+$docLines
+class MyClassTypeAlias = Object with MyClass;
+
+$docLines
+enum MyEnum {A, B, C}
+
+$docLines
+void myFunction() {}
+
+$docLines
+int myVariable;
+
+main() {^}
+''');
+ await computeSuggestions();
+ {
+ CompletionSuggestion suggestion = assertSuggestClass('MyClass');
+ assertDoc(suggestion);
+ }
+ {
+ CompletionSuggestion suggestion =
+ assertSuggestClassTypeAlias('MyClassTypeAlias');
+ assertDoc(suggestion);
+ }
+ {
+ CompletionSuggestion suggestion = assertSuggestEnum('MyEnum');
+ assertDoc(suggestion);
+ }
+ {
+ CompletionSuggestion suggestion = assertSuggestFunction(
+ 'myFunction', 'void',
+ relevance: DART_RELEVANCE_LOCAL_FUNCTION);
+ assertDoc(suggestion);
+ }
+ {
+ CompletionSuggestion suggestion = assertSuggestTopLevelVar(
+ 'myVariable', 'int',
+ relevance: DART_RELEVANCE_LOCAL_TOP_LEVEL_VARIABLE);
+ assertDoc(suggestion);
+ }
+ }
+
test_enum() async {
addTestSource('enum E { one, two } main() {^}');
await computeSuggestions();
« no previous file with comments | « pkg/analysis_server/lib/src/services/completion/dart/local_reference_contributor.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698