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

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

Issue 1534043002: Cache element docs (and add to completions) (#23694). (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: tweaks 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/imported_reference_contributor_test.dart
diff --git a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
index 231ce1d56ddb257ce15053df93a06ab7d83f0905..00d80dfb6940a072cfd3571432ba401383bbfc66 100644
--- a/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
+++ b/pkg/analysis_server/test/services/completion/dart/imported_reference_contributor_test.dart
@@ -45,6 +45,71 @@ class ImportedReferenceContributorTest extends DartCompletionContributorTest {
assertNotSuggested('two');
}
+ test_doc_class() async {
+ addSource(
+ '/libA.dart',
+ r'''
+library A;
+/// My class.
+/// Short description.
+///
+/// Longer description.
+class A {}
+''');
+ addTestSource('import "/libA.dart"; main() {^}');
+
+ await computeSuggestions();
+
+ CompletionSuggestion suggestion = assertSuggestClass('A');
+ expect(suggestion.docSummary, 'My class.\nShort description.');
+ expect(suggestion.docComplete,
+ 'My class.\nShort description.\n\nLonger description.');
+ }
+
+ test_doc_function() async {
+ resolveSource(
+ '/libA.dart',
+ r'''
+library A;
+/// My function.
+/// Short description.
+///
+/// Longer description.
+int myFunc() {}
+''');
+ addTestSource('import "/libA.dart"; main() {^}');
+
+ await computeSuggestions();
+
+ CompletionSuggestion suggestion = assertSuggestFunction('myFunc', 'int');
+ expect(suggestion.docSummary, 'My function.\nShort description.');
+ expect(suggestion.docComplete,
+ 'My function.\nShort description.\n\nLonger description.');
+ }
+
+ test_doc_function_c_style() async {
+ resolveSource(
+ '/libA.dart',
+ r'''
+library A;
+/**
+ * My function.
+ * Short description.
+ *
+ * Longer description.
+ */
+int myFunc() {}
+''');
+ addTestSource('import "/libA.dart"; main() {^}');
+
+ await computeSuggestions();
+
+ CompletionSuggestion suggestion = assertSuggestFunction('myFunc', 'int');
+ expect(suggestion.docSummary, 'My function.\nShort description.');
+ expect(suggestion.docComplete,
+ 'My function.\nShort description.\n\nLonger description.');
+ }
+
test_enum() async {
addSource('/libA.dart', 'library A; enum E { one, two }');
addTestSource('import "/libA.dart"; main() {^}');
« no previous file with comments | « pkg/analysis_server/lib/src/utilities/documentation.dart ('k') | pkg/analyzer/lib/dart/element/element.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698