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

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

Issue 2651103004: Issue 28387. Test for search of classes defined in SDK. (Closed)
Patch Set: Created 3 years, 11 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 | « no previous file | 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 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('''
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698