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

Side by Side Diff: pkg/analysis_server/test/analysis/get_hover_test.dart

Issue 1003193005: Add 'containingClassDescription' to HoverInformation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.domain.analysis.hover; 5 library test.domain.analysis.hover;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:unittest/unittest.dart'; 10 import 'package:unittest/unittest.dart';
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 library my.library; 74 library my.library;
75 /// doc aaa 75 /// doc aaa
76 /// doc bbb 76 /// doc bbb
77 List<String> fff(int a, String b) { 77 List<String> fff(int a, String b) {
78 } 78 }
79 '''); 79 ''');
80 return prepareHover('fff(int a').then((HoverInformation hover) { 80 return prepareHover('fff(int a').then((HoverInformation hover) {
81 // element 81 // element
82 expect(hover.containingLibraryName, 'my.library'); 82 expect(hover.containingLibraryName, 'my.library');
83 expect(hover.containingLibraryPath, testFile); 83 expect(hover.containingLibraryPath, testFile);
84 expect(hover.containingClassDescription, isNull);
84 expect(hover.dartdoc, '''doc aaa\ndoc bbb'''); 85 expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
85 expect(hover.elementDescription, 'fff(int a, String b) → List<String>'); 86 expect(hover.elementDescription, 'fff(int a, String b) → List<String>');
86 expect(hover.elementKind, 'function'); 87 expect(hover.elementKind, 'function');
87 // types 88 // types
88 expect(hover.staticType, '(int, String) → List<String>'); 89 expect(hover.staticType, '(int, String) → List<String>');
89 expect(hover.propagatedType, isNull); 90 expect(hover.propagatedType, isNull);
90 // no parameter 91 // no parameter
91 expect(hover.parameter, isNull); 92 expect(hover.parameter, isNull);
92 }); 93 });
93 } 94 }
94 95
95 test_expression_literal_noElement() { 96 test_expression_literal_noElement() {
96 addTestFile(''' 97 addTestFile('''
97 main() { 98 main() {
98 foo(123); 99 foo(123);
99 } 100 }
100 foo(Object myParameter) {} 101 foo(Object myParameter) {}
101 '''); 102 ''');
102 return prepareHover('123').then((HoverInformation hover) { 103 return prepareHover('123').then((HoverInformation hover) {
103 // literal, no Element 104 // literal, no Element
105 expect(hover.containingClassDescription, isNull);
104 expect(hover.elementDescription, isNull); 106 expect(hover.elementDescription, isNull);
105 expect(hover.elementKind, isNull); 107 expect(hover.elementKind, isNull);
106 // types 108 // types
107 expect(hover.staticType, 'int'); 109 expect(hover.staticType, 'int');
108 expect(hover.propagatedType, isNull); 110 expect(hover.propagatedType, isNull);
109 // parameter 111 // parameter
110 expect(hover.parameter, 'Object myParameter'); 112 expect(hover.parameter, 'Object myParameter');
111 }); 113 });
112 } 114 }
113 115
114 test_expression_method() { 116 test_expression_method() {
115 addTestFile(''' 117 addTestFile('''
116 library my.library; 118 library my.library;
117 class A { 119 class A {
118 /// doc aaa 120 /// doc aaa
119 /// doc bbb 121 /// doc bbb
120 List<String> mmm(int a, String b) { 122 List<String> mmm(int a, String b) {
121 } 123 }
122 } 124 }
123 '''); 125 ''');
124 return prepareHover('mmm(int a').then((HoverInformation hover) { 126 return prepareHover('mmm(int a').then((HoverInformation hover) {
125 // element 127 // element
126 expect(hover.containingLibraryName, 'my.library'); 128 expect(hover.containingLibraryName, 'my.library');
127 expect(hover.containingLibraryPath, testFile); 129 expect(hover.containingLibraryPath, testFile);
130 expect(hover.containingClassDescription, 'A');
128 expect(hover.dartdoc, '''doc aaa\ndoc bbb'''); 131 expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
129 expect(hover.elementDescription, 'A.mmm(int a, String b) → List<String>'); 132 expect(hover.elementDescription, 'A.mmm(int a, String b) → List<String>');
130 expect(hover.elementKind, 'method'); 133 expect(hover.elementKind, 'method');
131 // types 134 // types
132 expect(hover.staticType, '(int, String) → List<String>'); 135 expect(hover.staticType, '(int, String) → List<String>');
133 expect(hover.propagatedType, isNull); 136 expect(hover.propagatedType, isNull);
134 // no parameter 137 // no parameter
135 expect(hover.parameter, isNull); 138 expect(hover.parameter, isNull);
136 }); 139 });
137 } 140 }
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 String fff; 176 String fff;
174 } 177 }
175 main(A a) { 178 main(A a) {
176 print(a.fff); 179 print(a.fff);
177 } 180 }
178 '''); 181 ''');
179 return prepareHover('fff);').then((HoverInformation hover) { 182 return prepareHover('fff);').then((HoverInformation hover) {
180 // element 183 // element
181 expect(hover.containingLibraryName, 'my.library'); 184 expect(hover.containingLibraryName, 'my.library');
182 expect(hover.containingLibraryPath, testFile); 185 expect(hover.containingLibraryPath, testFile);
186 expect(hover.containingClassDescription, 'A');
183 expect(hover.dartdoc, '''doc aaa\ndoc bbb'''); 187 expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
184 expect(hover.elementDescription, 'String fff'); 188 expect(hover.elementDescription, 'String fff');
185 expect(hover.elementKind, 'field'); 189 expect(hover.elementKind, 'field');
186 // types 190 // types
187 expect(hover.staticType, 'String'); 191 expect(hover.staticType, 'String');
188 expect(hover.propagatedType, isNull); 192 expect(hover.propagatedType, isNull);
189 }); 193 });
190 } 194 }
191 195
192 test_expression_variable_hasPropagatedType() { 196 test_expression_variable_hasPropagatedType() {
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 library my.library; 305 library my.library;
302 main() { 306 main() {
303 // nothing 307 // nothing
304 } 308 }
305 '''); 309 ''');
306 return prepareHover('nothing').then((HoverInformation hover) { 310 return prepareHover('nothing').then((HoverInformation hover) {
307 expect(hover, isNull); 311 expect(hover, isNull);
308 }); 312 });
309 } 313 }
310 } 314 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/generated_protocol.dart ('k') | pkg/analysis_server/test/integration/protocol_matchers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698