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

Unified Diff: pkg/analysis_server/test/analysis/get_navigation_test.dart

Issue 1402353009: [Atom] Issue 424. Fix for 'getNavigation' and index expressions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 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
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() {

Powered by Google App Engine
This is Rietveld 408576698