Index: pkg/analysis_server/test/analysis/get_navigation_test.dart |
diff --git a/pkg/analysis_server/test/analysis/get_navigation_test.dart b/pkg/analysis_server/test/analysis/get_navigation_test.dart |
index fb4916975501913f5919b8b1cf7692cc5773c0f1..add8b90dd59f7bab5c008b0044ca01f2ac7bf561 100644 |
--- a/pkg/analysis_server/test/analysis/get_navigation_test.dart |
+++ b/pkg/analysis_server/test/analysis/get_navigation_test.dart |
@@ -58,7 +58,7 @@ main() { |
return _checkInvalid(file, -1, -1); |
} |
- test_issue24599_importDirective() async { |
+ test_importDirective() async { |
addTestFile(''' |
import 'dart:math'; |
@@ -72,7 +72,7 @@ main() { |
expect(testTargets[0].kind, ElementKind.LIBRARY); |
} |
- test_issue24599_importKeyword() async { |
+ test_importKeyword() async { |
addTestFile(''' |
import 'dart:math'; |
@@ -86,7 +86,7 @@ main() { |
expect(testTargets[0].kind, ElementKind.LIBRARY); |
} |
- test_issue24599_importUri() async { |
+ test_importUri() async { |
addTestFile(''' |
import 'dart:math'; |
@@ -130,6 +130,52 @@ main() { |
assertNoRegionAt('ddd)'); |
} |
+ test_operator_index() async { |
+ addTestFile(''' |
+class A { |
+ A operator [](index) => null; |
+ operator []=(index, A value) {} |
+} |
+main() { |
+ var a = new A(); |
+ a[0] // []; |
+ a[1] = 1; // []=; |
+ a[2] += 2; |
+} |
+'''); |
+ await waitForTasksFinished(); |
+ { |
+ String search = '[0'; |
+ await _getNavigation(testFile, testCode.indexOf(search), 1); |
+ assertHasOperatorRegion(search, 1, '[](index)', 2); |
+ } |
+ { |
+ String search = '] // []'; |
+ await _getNavigation(testFile, testCode.indexOf(search), 1); |
+ assertHasOperatorRegion(search, 1, '[](index)', 2); |
+ } |
+ { |
+ String search = '[1'; |
+ await _getNavigation(testFile, testCode.indexOf(search), 1); |
+ assertHasOperatorRegion(search, 1, '[]=(index', 3); |
+ } |
+ { |
+ String search = '] = 1'; |
+ await _getNavigation(testFile, testCode.indexOf(search), 1); |
+ assertHasOperatorRegion(search, 1, '[]=(index', 3); |
+ } |
+ { |
+ String search = '[2'; |
+ await _getNavigation(testFile, testCode.indexOf(search), 1); |
+ assertHasOperatorRegion(search, 1, '[]=(index', 3); |
+ } |
+ { |
+ String search = '] += 2'; |
+ await _getNavigation(testFile, testCode.indexOf(search), 1); |
+ assertHasOperatorRegion(search, 1, '[]=(index', 3); |
+ } |
+ } |
+ |
test_removeContextAfterRequest() async { |
addTestFile(''' |
main() { |