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

Unified Diff: pkg/analyzer/test/src/dart/analysis/search_test.dart

Issue 2535173004: Implement search for PrefixElement. (Closed)
Patch Set: Created 4 years, 1 month 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/lib/src/dart/analysis/search.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/dart/analysis/search_test.dart
diff --git a/pkg/analyzer/test/src/dart/analysis/search_test.dart b/pkg/analyzer/test/src/dart/analysis/search_test.dart
index 8872ebd28c6c8ac2d7cf3f217c42ff1d728e8d59..e473ffc15d4b64fa589c9faed7731e3c3ce72665 100644
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart
@@ -38,6 +38,7 @@ class ExpectedResult {
result.isResolved == this.isResolved &&
result.isQualified == this.isQualified &&
result.offset == this.offset &&
+ result.length == this.length &&
result.enclosingElement == this.enclosingElement;
}
@@ -510,6 +511,34 @@ main() {
await _verifyReferences(element, expected);
}
+ test_searchReferences_PrefixElement() async {
+ String partCode = r'''
+part of my_lib;
+ppp.Future c;
+''';
+ provider.newFile(_p('$testProject/my_part.dart'), partCode);
+ await _resolveTestUnit('''
+library my_lib;
+import 'dart:async' as ppp;
+part 'my_part.dart';
+main() {
+ ppp.Future a;
+ ppp.Stream b;
+}
+''');
+ PrefixElement element = _findElementAtString('ppp;');
+ Element a = _findElement('a');
+ Element b = _findElement('b');
+ Element c = findChildElement(testLibraryElement, 'c');
+ var expected = [
+ _expectId(a, SearchResultKind.REFERENCE, 'ppp.Future'),
+ _expectId(b, SearchResultKind.REFERENCE, 'ppp.Stream'),
+ new ExpectedResult(c, SearchResultKind.REFERENCE,
+ partCode.indexOf('ppp.Future c'), 'ppp'.length)
+ ];
+ await _verifyReferences(element, expected);
+ }
+
test_searchReferences_PropertyAccessorElement_getter() async {
await _resolveTestUnit('''
class A {
« no previous file with comments | « pkg/analyzer/lib/src/dart/analysis/search.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698