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

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

Issue 694383003: Issue 21498. Fix for navigation from instance creation with type arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Restore non-generic tests Created 6 years, 1 month 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/computer/computer_navigation.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 42c2d5a3776dd49734ad47014c58034f2ab005f7..fc40264b539413ef4949bfa04e3f2bd423668dc3 100644
--- a/pkg/analysis_server/test/analysis/notification_navigation_test.dart
+++ b/pkg/analysis_server/test/analysis/notification_navigation_test.dart
@@ -318,8 +318,35 @@ main() {
}
''');
return prepareNavigation().then((_) {
- findRegion(findOffset('new A'), 'new A'.length, true);
- assertHasTarget('A {');
+ {
+ findRegion(findOffset('new A'), 'new'.length, true);
+ assertHasTarget('A {');
+ }
+ {
+ findRegion(findOffset('A()'), 'A'.length, true);
+ assertHasTarget('A {');
+ }
+ });
+ }
+
+ test_instanceCreation_implicit_withTypeArgument() {
+ addTestFile('''
+class A {}
+class B<T> {
+}
+main() {
+ new B<A>();
+}
+''');
+ return prepareNavigation().then((_) {
+ {
+ findRegion(findOffset('new B'), 'new'.length, true);
+ assertHasTarget('B<T> {');
+ }
+ {
+ findRegion(findOffset('A>();'), 'A'.length, true);
+ assertHasTarget('A {');
+ }
});
}
@@ -348,6 +375,36 @@ main() {
});
}
+ test_instanceCreation_named_withTypeArgument() {
+ addTestFile('''
+class A {}
+class B<T> {
+ A.named() {}
+}
+main() {
+ new B<A>.named();
+}
+''');
+ return prepareNavigation().then((_) {
+ {
+ findRegion(findOffset('new '), 'new'.length, true);
+ assertHasTarget('named() {}');
+ }
+ {
+ findRegion(findOffset('B<A>.named();'), 'B'.length, true);
+ assertHasTarget('B<T> {');
+ }
+ {
+ findRegion(findOffset('.named();'), '.named'.length, true);
+ assertHasTarget('named() {}');
+ }
+ {
+ findRegion(findOffset('A>.named();'), 'A'.length, true);
+ assertHasTarget('A {');
+ }
+ });
+ }
+
test_instanceCreation_unnamed() {
addTestFile('''
class A {
@@ -369,6 +426,32 @@ main() {
});
}
+ test_instanceCreation_unnamed_withTypeArgument() {
+ addTestFile('''
+class A {}
+class B<T> {
+ B() {}
+}
+main() {
+ new B<A>();
+}
+''');
+ return prepareNavigation().then((_) {
+ {
+ findRegion(findOffset('new '), 'new'.length, true);
+ assertHasTarget('B() {}', 0);
+ }
+ {
+ findRegion(findOffset('B<A>();'), 'B'.length, true);
+ assertHasTarget('B<T> {');
+ }
+ {
+ findRegion(findOffset('A>();'), 'A'.length, true);
+ assertHasTarget('A {');
+ }
+ });
+ }
+
test_multiplyDefinedElement() {
addFile('$projectPath/bin/libA.dart', 'library A; int TEST = 1;');
addFile('$projectPath/bin/libB.dart', 'library B; int TEST = 2;');
« no previous file with comments | « pkg/analysis_server/lib/src/computer/computer_navigation.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698