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

Unified Diff: pkg/analysis_server/test/services/search/search_engine_test.dart

Issue 2409403002: Issue 27542. Guard against CompilationUnitElement is null in SearchMatch.element getter. (Closed)
Patch Set: Created 4 years, 2 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/search/search_engine.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/services/search/search_engine_test.dart
diff --git a/pkg/analysis_server/test/services/search/search_engine_test.dart b/pkg/analysis_server/test/services/search/search_engine_test.dart
index 86f1d6f0241f6aac737c2931c0228ce1758aa448..8072301d51afba0ca33948440d62f83583c7758b 100644
--- a/pkg/analysis_server/test/services/search/search_engine_test.dart
+++ b/pkg/analysis_server/test/services/search/search_engine_test.dart
@@ -617,6 +617,23 @@ main(A<int> a) {
await _verifyReferences(method, expected);
}
+ test_searchReferences_null_noUnitElement() async {
+ _indexTestUnit('''
+class A {
+ m() {}
+}
+main(A a) {
+ a.m();
+}
+''');
+ MethodElement method = findElement('m');
+ List<SearchMatch> matches = await searchEngine.searchReferences(method);
+ expect(matches, hasLength(1));
+ // Set the source contents, so the element is invalidated.
+ context.setContents(testSource, '');
+ expect(matches.single.element, isNull);
+ }
+
test_searchReferences_ParameterElement_ofConstructor() async {
_indexTestUnit('''
class C {
« no previous file with comments | « pkg/analysis_server/lib/src/services/search/search_engine.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698