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 5a9abb0e66c8927ff8efe05361c3a40dd88b62cc..a23d0c4fa84527293067e6d96b167dc1a605bc60 100644 |
--- a/pkg/analysis_server/test/services/index2/index2_test.dart |
+++ b/pkg/analysis_server/test/services/index2/index2_test.dart |
@@ -180,6 +180,29 @@ main(A a, p) { |
findLocationTest(locations, 'test); // p-ref-ur-q'); |
} |
+ test_indexUnit_nullUnit() async { |
+ index.indexUnit(null); |
+ } |
+ |
+ test_indexUnit_nullUnitElement() async { |
+ resolveTestUnit(''); |
+ testUnit.element = null; |
+ index.indexUnit(testUnit); |
+ } |
+ |
+ test_removeContext() async { |
+ _indexTestUnit(''' |
+class A {} |
+'''); |
+ RegExp regExp = new RegExp(r'^A$'); |
+ expect(await index.getDefinedNames(regExp, IndexNameKind.topLevel), |
+ hasLength(1)); |
+ // remove the context - no |
+ index.removeContext(context); |
+ expect( |
+ await index.getDefinedNames(regExp, IndexNameKind.topLevel), isEmpty); |
+ } |
+ |
/** |
* Assert that the given list of [locations] has a [Location] corresponding |
* to the [element]. |