Index: pkg/analyzer/test/src/context/context_test.dart |
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart |
index c8832031da83cc550c6c7f9b9bedfe84735f7de7..62b499015ed77f9d18a7a005dc18ba80aac36394 100644 |
--- a/pkg/analyzer/test/src/context/context_test.dart |
+++ b/pkg/analyzer/test/src/context/context_test.dart |
@@ -397,7 +397,7 @@ import 'libB.dart';'''; |
}); |
} |
- void test_computeDocumentationComment_block() { |
+ void test_computeDocumentationComment_class_block() { |
String comment = "/** Comment */"; |
Source source = addSource( |
"/test.dart", |
@@ -411,7 +411,7 @@ class A {}"""); |
expect(context.computeDocumentationComment(classElement), comment); |
} |
- void test_computeDocumentationComment_none() { |
+ void test_computeDocumentationComment_class_none() { |
Source source = addSource("/test.dart", "class A {}"); |
LibraryElement libraryElement = context.computeLibraryElement(source); |
expect(libraryElement, isNotNull); |
@@ -420,11 +420,7 @@ class A {}"""); |
expect(context.computeDocumentationComment(classElement), isNull); |
} |
- void test_computeDocumentationComment_null() { |
- expect(context.computeDocumentationComment(null), isNull); |
- } |
- |
- void test_computeDocumentationComment_singleLine_multiple_EOL_n() { |
+ void test_computeDocumentationComment_class_singleLine_multiple_EOL_n() { |
String comment = "/// line 1\n/// line 2\n/// line 3\n"; |
Source source = addSource("/test.dart", "${comment}class A {}"); |
LibraryElement libraryElement = context.computeLibraryElement(source); |
@@ -435,7 +431,7 @@ class A {}"""); |
expect(actual, "/// line 1\n/// line 2\n/// line 3"); |
} |
- void test_computeDocumentationComment_singleLine_multiple_EOL_rn() { |
+ void test_computeDocumentationComment_class_singleLine_multiple_EOL_rn() { |
String comment = "/// line 1\r\n/// line 2\r\n/// line 3\r\n"; |
Source source = addSource("/test.dart", "${comment}class A {}"); |
LibraryElement libraryElement = context.computeLibraryElement(source); |
@@ -446,6 +442,51 @@ class A {}"""); |
expect(actual, "/// line 1\n/// line 2\n/// line 3"); |
} |
+ void test_computeDocumentationComment_exportDirective_block() { |
+ String comment = '/** Comment */'; |
+ Source source = addSource( |
+ "/test.dart", |
+ ''' |
+$comment |
+export 'dart:async'; |
+'''); |
+ LibraryElement libraryElement = context.computeLibraryElement(source); |
+ expect(libraryElement, isNotNull); |
+ ExportElement exportElement = libraryElement.exports[0]; |
+ expect(context.computeDocumentationComment(exportElement), comment); |
+ } |
+ |
+ void test_computeDocumentationComment_importDirective_block() { |
+ String comment = '/** Comment */'; |
+ Source source = addSource( |
+ "/test.dart", |
+ ''' |
+$comment |
+import 'dart:async'; |
+'''); |
+ LibraryElement libraryElement = context.computeLibraryElement(source); |
+ expect(libraryElement, isNotNull); |
+ ImportElement importElement = libraryElement.imports[0]; |
+ expect(context.computeDocumentationComment(importElement), comment); |
+ } |
+ |
+ void test_computeDocumentationComment_libraryDirective_block() { |
+ String comment = '/** Comment */'; |
+ Source source = addSource( |
+ "/test.dart", |
+ ''' |
+$comment |
+library lib; |
+'''); |
+ LibraryElement libraryElement = context.computeLibraryElement(source); |
+ expect(libraryElement, isNotNull); |
+ expect(context.computeDocumentationComment(libraryElement), comment); |
+ } |
+ |
+ void test_computeDocumentationComment_null() { |
+ expect(context.computeDocumentationComment(null), isNull); |
+ } |
+ |
void test_computeErrors_dart_none() { |
Source source = addSource("/lib.dart", "library lib;"); |
List<AnalysisError> errors = context.computeErrors(source); |