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

Unified Diff: pkg/analysis_server/test/services/index/index_test.dart

Issue 1829463002: Issue 26063. Index declarations in even partically analyzed units. (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/analysis_server/lib/src/services/index/index.dart ('k') | pkg/analyzer/lib/src/summary/index_unit.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/index/index_test.dart
diff --git a/pkg/analysis_server/test/services/index/index_test.dart b/pkg/analysis_server/test/services/index/index_test.dart
index 406479e80b3428353ecb2e741c1e5c93b928b4ab..17874073a0e676953f358b57bbc18b7f99f7d888 100644
--- a/pkg/analysis_server/test/services/index/index_test.dart
+++ b/pkg/analysis_server/test/services/index/index_test.dart
@@ -122,6 +122,23 @@ class NoMatchABCDE {}
_assertHasDefinedName(locations, topE);
}
+ test_getDefinedNames_topLevel2() async {
+ _indexTestUnit(
+ '''
+class A {} // A
+class B = Object with A;
+class NoMatchABCDE {}
+''',
+ declOnly: true);
+ Element topA = findElement('A');
+ Element topB = findElement('B');
+ List<Location> locations = await index.getDefinedNames(
+ new RegExp(r'^[A-E]$'), IndexNameKind.topLevel);
+ expect(locations, hasLength(2));
+ _assertHasDefinedName(locations, topA);
+ _assertHasDefinedName(locations, topB);
+ }
+
test_getRelations_isExtendedBy() async {
_indexTestUnit(r'''
class A {}
@@ -230,6 +247,16 @@ class A {
findLocationTest(locations, 'test();', false);
}
+ test_indexDeclarations_nullUnit() async {
+ index.indexDeclarations(null);
+ }
+
+ test_indexDeclarations_nullUnitElement() async {
+ resolveTestUnit('');
+ testUnit.element = null;
+ index.indexDeclarations(testUnit);
+ }
+
test_indexUnit_nullUnit() async {
index.indexUnit(null);
}
@@ -298,9 +325,13 @@ class A {}
'${locations.join('\n')}');
}
- void _indexTestUnit(String code) {
+ void _indexTestUnit(String code, {bool declOnly: false}) {
resolveTestUnit(code);
- index.indexUnit(testUnit);
+ if (declOnly) {
+ index.indexDeclarations(testUnit);
+ } else {
+ index.indexUnit(testUnit);
+ }
}
Source _indexUnit(String path, String code) {
« no previous file with comments | « pkg/analysis_server/lib/src/services/index/index.dart ('k') | pkg/analyzer/lib/src/summary/index_unit.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698