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

Unified Diff: pkg/analyzer/test/src/summary/index_unit_test.dart

Issue 1738283002: Test for duplicate referenced in index and clean up super types. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/analyzer/lib/src/summary/index_unit.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/summary/index_unit_test.dart
diff --git a/pkg/analyzer/test/src/summary/index_unit_test.dart b/pkg/analyzer/test/src/summary/index_unit_test.dart
index c1543967638a4bb5d394d5ad388e4852523d7dcc..5c6f03b481463e6ad21174e51ae83582660e9aab 100644
--- a/pkg/analyzer/test/src/summary/index_unit_test.dart
+++ b/pkg/analyzer/test/src/summary/index_unit_test.dart
@@ -522,20 +522,28 @@ A myVariable = null;
*/
void _assertHasRelation(
Element element,
- IndexRelationKind expectedRelationship,
+ IndexRelationKind expectedRelationKind,
ExpectedLocation expectedLocation) {
int elementId = _findElementId(element);
+ int matchIndex;
for (int i = 0; i < unitIndex.locationOffsets.length; i++) {
if (unitIndex.elements[i] == elementId &&
unitIndex.locationOffsets[i] == expectedLocation.offset &&
unitIndex.locationLengths[i] == expectedLocation.length) {
- // TODO(scheglov) continue looking to check that only one usage at one
- // location, e.g. no both 'reference' and 'invocation'.
- return;
+ if (matchIndex == null) {
+ matchIndex = i;
+ } else {
+ _failWithIndexDump('more then one ($matchIndex and $i) match found\n'
+ '$element at $expectedLocation');
+ }
}
}
+ if (matchIndex != null &&
+ unitIndex.kinds[matchIndex] == expectedRelationKind) {
+ return;
+ }
_failWithIndexDump(
- 'not found\n$element $expectedRelationship at $expectedLocation');
+ 'not found\n$element $expectedRelationKind at $expectedLocation');
}
ExpectedLocation _expectedLocation(String search,
@@ -563,7 +571,8 @@ A myVariable = null;
if (element is LibraryElement || element is CompilationUnitElement) {
offset = 0;
}
- IndexSyntheticElementKind kind = PackageIndexAssembler.getIndexElementKind(element);
+ IndexSyntheticElementKind kind =
+ PackageIndexAssembler.getIndexElementKind(element);
for (int elementId = 0;
elementId < packageIndex.elementUnits.length;
elementId++) {
« no previous file with comments | « pkg/analyzer/lib/src/summary/index_unit.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698