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

Unified Diff: pkg/analyzer/test/src/task/dart_test.dart

Issue 1850813002: Issue dartdoc#1124. Get used elements from directive comments. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 9 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/analyzer/test/generated/hint_code_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/test/src/task/dart_test.dart
diff --git a/pkg/analyzer/test/src/task/dart_test.dart b/pkg/analyzer/test/src/task/dart_test.dart
index c07689b09a01e81f099f6f991fcce682fe2c99c4..b0352cb3215e19fa9882bde3ecd15218302b1c85 100644
--- a/pkg/analyzer/test/src/task/dart_test.dart
+++ b/pkg/analyzer/test/src/task/dart_test.dart
@@ -2227,7 +2227,7 @@ class GatherUsedImportedElementsTaskTest extends _AbstractDartTaskTest {
UsedImportedElements usedElements;
Set<String> usedElementNames;
- test_perform() {
+ test_perform_inBody() {
newSource(
'/a.dart',
r'''
@@ -2253,6 +2253,54 @@ main() {
expect(usedElementNames, unorderedEquals(['A']));
}
+ test_perform_inComment_exportDirective() {
+ Source source = newSource(
+ '/test.dart',
+ r'''
+import 'dart:async';
+/// Use [Future].
+export 'dart:math';
+''');
+ _computeUsedElements(source);
+ expect(usedElementNames, unorderedEquals(['Future']));
+ }
+
+ test_perform_inComment_importDirective() {
+ Source source = newSource(
+ '/test.dart',
+ r'''
+import 'dart:async';
+/// Use [Future].
+import 'dart:math';
+''');
+ _computeUsedElements(source);
+ expect(usedElementNames, unorderedEquals(['Future']));
+ }
+
+ test_perform_inComment_libraryDirective() {
+ Source source = newSource(
+ '/test.dart',
+ r'''
+/// Use [Future].
+library test;
+import 'dart:async';
+''');
+ _computeUsedElements(source);
+ expect(usedElementNames, unorderedEquals(['Future']));
+ }
+
+ test_perform_inComment_topLevelFunction() {
+ Source source = newSource(
+ '/test.dart',
+ r'''
+import 'dart:async';
+/// Use [Future].
+main() {}
+''');
+ _computeUsedElements(source);
+ expect(usedElementNames, unorderedEquals(['Future']));
+ }
+
void _computeUsedElements(Source source) {
LibrarySpecificUnit target = new LibrarySpecificUnit(source, source);
computeResult(target, USED_IMPORTED_ELEMENTS,
« no previous file with comments | « pkg/analyzer/test/generated/hint_code_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698