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 2cdd669b6e1c64860dfa77f6befb45493a32067c..2c0f579d3320267116bef240150a77da9abeae3e 100644 |
--- a/pkg/analyzer/test/src/dart/analysis/search_test.dart |
+++ b/pkg/analyzer/test/src/dart/analysis/search_test.dart |
@@ -218,6 +218,31 @@ main(A p) { |
await _verifyReferences(element, expected); |
} |
+ test_searchReferences_ClassElement_definedInSdk() async { |
+ await _resolveTestUnit(''' |
+import 'dart:math'; |
+Random v1; |
+Random v2; |
+'''); |
+ |
+ // Find the Random class element in the SDK source. |
+ // IDEA performs search always at declaration, never at reference. |
Brian Wilkerson
2017/01/25 14:52:42
I don't understand the second line of this comment
scheglov
2017/01/25 15:02:19
Yes, kind of.
When you search on Random in "Rando
Brian Wilkerson
2017/01/25 15:09:27
Ok. It makes perfect sense to test that code path
scheglov
2017/01/25 16:38:57
Done.
|
+ ClassElement randomElement; |
+ { |
+ String randomPath = sdk.mapDartUri('dart:math').fullName; |
+ AnalysisResult result = await driver.getResult(randomPath); |
+ randomElement = result.unit.element.getType('Random'); |
+ } |
+ |
+ Element v1 = _findElement('v1'); |
+ Element v2 = _findElement('v2'); |
+ var expected = [ |
+ _expectId(v1, SearchResultKind.REFERENCE, 'Random v1;'), |
+ _expectId(v2, SearchResultKind.REFERENCE, 'Random v2;'), |
+ ]; |
+ await _verifyReferences(randomElement, expected); |
+ } |
+ |
test_searchReferences_CompilationUnitElement() async { |
provider.newFile(_p('$testProject/foo.dart'), ''); |
await _resolveTestUnit(''' |