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

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

Issue 1378713004: Issue 24487. Annotations with constructor resolution should produce navigation reginos to construct… (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
« no previous file with comments | « pkg/analysis_server/lib/src/domains/analysis/navigation_dart.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/analysis/notification_navigation_test.dart
diff --git a/pkg/analysis_server/test/analysis/notification_navigation_test.dart b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
index fee0d6f8a60ea36005eee60f101f8b4456060b03..6ef6b5724c7ff299ffcf8e0e5b05f7767328b78f 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -215,6 +215,113 @@ AAA aaa;
});
}
+ test_annotationConstructor_implicit() async {
+ addTestFile('''
+class A {
+}
+@A()
+main() {
+}
+''');
+ await prepareNavigation();
+ assertHasRegionString('A()', 'A'.length);
+ assertHasTarget('A {');
+ }
+
+ test_annotationConstructor_importPrefix() async {
+ addFile(
+ '$testFolder/my_annotation.dart',
+ r'''
+library an;
+class MyAnnotation {
+ const MyAnnotation();
+ const MyAnnotation.named();
+}
+''');
+ addTestFile('''
+import 'my_annotation.dart' as man;
+@man.MyAnnotation()
+@man.MyAnnotation.named()
+main() {
+}
+''');
+ await prepareNavigation();
+ assertHasRegion('MyAnnotation()');
+ assertHasRegion('MyAnnotation.named()');
+ assertHasRegion('named()');
+ {
+ assertHasRegion('man.MyAnnotation()');
+ assertHasTarget('man;');
+ }
+ {
+ assertHasRegion('man.MyAnnotation.named()');
+ assertHasTarget('man;');
+ }
+ }
+
+ test_annotationConstructor_named() async {
+ addTestFile('''
+class A {
+ const A.named(p);
+}
+@A.named(0)
+main() {
+}
+''');
+ await prepareNavigation();
+ {
+ assertHasRegion('A.named(0)');
+ assertHasTarget('named(p);');
+ }
+ {
+ assertHasRegion('named(0)');
+ assertHasTarget('named(p);');
+ }
+ }
+
+ test_annotationConstructor_unnamed() async {
+ addTestFile('''
+class A {
+ const A();
+}
+@A()
+main() {
+}
+''');
+ await prepareNavigation();
+ assertHasRegionString('A()', 'A'.length);
+ assertHasTarget('A();', 0);
+ }
+
+ test_annotationField() async {
+ addTestFile('''
+const myan = new Object();
+@myan // ref
+main() {
+}
+''');
+ await prepareNavigation();
+ assertHasRegion('myan // ref');
+ assertHasTarget('myan = new Object();');
+ }
+
+ test_annotationField_importPrefix() async {
+ addFile(
+ '$testFolder/mayn.dart',
+ r'''
+library an;
+const myan = new Object();
+''');
+ addTestFile('''
+import 'mayn.dart' as man;
+@man.myan // ref
+main() {
+}
+''');
+ await prepareNavigation();
+ assertHasRegion('myan // ref');
+ }
+
test_class_fromSDK() {
addTestFile('''
int V = 42;
« no previous file with comments | « pkg/analysis_server/lib/src/domains/analysis/navigation_dart.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698