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

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

Issue 921833002: Issue 22381. Fix for navigating to constructor from redirecting factory constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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/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 b04ff9c5a9dc860b71b30b468cb8dd7a9fe11153..a68da1d051eda2c996f4dae1bce57582430a3a8f 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -255,6 +255,129 @@ class BBB {}
});
}
+ test_factoryRedirectingConstructor_implicit() {
+ addTestFile('''
+class A {
+ factory A() = B;
+}
+class B {
+}
+''');
+ return prepareNavigation().then((_) {
+ assertHasRegion('B;');
+ assertHasTarget('B {');
+ });
+ }
+
+ test_factoryRedirectingConstructor_implicit_withTypeArgument() {
+ addTestFile('''
+class A {}
+class B {
+ factory B() = C<A>;
+}
+class C<T> {}
+''');
+ return prepareNavigation().then((_) {
+ {
+ assertHasRegion('C<A>');
+ assertHasTarget('C<T> {');
+ }
+ {
+ assertHasRegion('A>;');
+ assertHasTarget('A {');
+ }
+ });
+ }
+
+ test_factoryRedirectingConstructor_named() {
+ addTestFile('''
+class A {
+ factory A() = B.named;
+}
+class B {
+ B.named();
+}
+''');
+ return prepareNavigation().then((_) {
+ assertHasRegionString('B.named');
+ assertHasTarget('named();');
+ });
+ }
+
+ test_factoryRedirectingConstructor_named_withTypeArgument() {
+ addTestFile('''
+class A {}
+class B {
+ factory B.named() = C<A>.named;
+}
+class C<T> {
+ C.named() {}
+}
+''');
+ return prepareNavigation().then((_) {
+ {
+ assertHasRegion('C<A>');
+ assertHasTarget('named() {}');
+ }
+ {
+ assertHasRegion('A>.named');
+ assertHasTarget('A {');
+ }
+ {
+ assertHasRegion('.named;', '.named'.length);
+ assertHasTarget('named() {}');
+ }
+ });
+ }
+
+ test_factoryRedirectingConstructor_unnamed() {
+ addTestFile('''
+class A {
+ factory A() = B;
+}
+class B {
+ B() {}
+}
+''');
+ return prepareNavigation().then((_) {
+ assertHasRegion('B;');
+ assertHasTarget('B() {}', 0);
+ });
+ }
+
+ test_factoryRedirectingConstructor_unnamed_withTypeArgument() {
+ addTestFile('''
+class A {}
+class B {
+ factory B() = C<A>;
+}
+class C<T> {
+ C() {}
+}
+''');
+ return prepareNavigation().then((_) {
+ {
+ assertHasRegion('C<A>');
+ assertHasTarget('C() {}', 0);
+ }
+ {
+ assertHasRegion('A>;');
+ assertHasTarget('A {');
+ }
+ });
+ }
+
+ test_factoryRedirectingConstructor_unresolved() {
+ addTestFile('''
+class A {
+ factory A() = B;
+}
+''');
+ return prepareNavigation().then((_) {
+ // don't check regions, but there should be no exceptions
+ });
+ }
+
test_fieldFormalParameter() {
addTestFile('''
class AAA {
@@ -370,7 +493,7 @@ main() {
addTestFile('''
class A {}
class B<T> {
- A.named() {}
+ B.named() {}
}
main() {
new B<A>.named();

Powered by Google App Engine
This is Rietveld 408576698