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

Unified Diff: pkg/analysis_server/test/services/index2/index2_test.dart

Issue 1768353002: Implement SearchEngine.searchMemberReferences(). (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
Index: pkg/analysis_server/test/services/index2/index2_test.dart
diff --git a/pkg/analysis_server/test/services/index2/index2_test.dart b/pkg/analysis_server/test/services/index2/index2_test.dart
index d64faebc0834622fc06e2f9395f2ab29b3d9eae9..d65ca3fd849bc3caaa29e0082ebdbffeed9913ce 100644
--- a/pkg/analysis_server/test/services/index2/index2_test.dart
+++ b/pkg/analysis_server/test/services/index2/index2_test.dart
@@ -148,6 +148,37 @@ main(int a, int b) {
findLocationTest(locations, 'int b');
}
+ test_getUnresolvedMemberReferences() async {
+ _indexTestUnit('''
+class A {
+ var test; // A
+ mainA() {
+ test(); // a-inv-r-nq
+ test = 1; // a-ref-r-nq
+ test += 2; // a-ref-r-nq
+ print(test); // a-ref-r-nq
+ }
+}
+main(A a, p) {
+ a.test(); // a-inv-r-q
+ a.test = 1; // a-ref-r-q
+ a.test += 2; // a-ref-r-q
+ print(a.test); // a-ref-r-q
+ p.test(); // p-inv-ur-q
+ p.test = 1; // p-ref-ur-q
+ p.test += 2; // p-ref-ur-q
+ print(p.test); // p-ref-ur-q
+}
+''');
+ List<Location> locations =
+ await index.getUnresolvedMemberReferences('test');
+ expect(locations, hasLength(4));
+ findLocationTest(locations, 'test(); // p-inv-ur-q');
+ findLocationTest(locations, 'test = 1; // p-ref-ur-q');
+ findLocationTest(locations, 'test += 2; // p-ref-ur-q');
+ findLocationTest(locations, 'test); // p-ref-ur-q');
+ }
+
/**
* Assert that the given list of [locations] has a [Location] corresponding
* to the [element].

Powered by Google App Engine
This is Rietveld 408576698