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

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

Issue 2681233005: Analysis.getHover should return the field's documentation for field formal parameters. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
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/plugin/protocol/protocol.dart'; 9 import 'package:analysis_server/plugin/protocol/protocol.dart';
10 import 'package:test/test.dart'; 10 import 'package:test/test.dart';
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 expect(hover.dartdoc, 'The method documentation.'); 301 expect(hover.dartdoc, 'The method documentation.');
302 expect(hover.elementDescription, 'int p'); 302 expect(hover.elementDescription, 'int p');
303 expect(hover.elementKind, 'parameter'); 303 expect(hover.elementKind, 'parameter');
304 // types 304 // types
305 expect(hover.staticType, 'int'); 305 expect(hover.staticType, 'int');
306 expect(hover.propagatedType, isNull); 306 expect(hover.propagatedType, isNull);
307 // no parameter 307 // no parameter
308 expect(hover.parameter, isNull); 308 expect(hover.parameter, isNull);
309 } 309 }
310 310
311 test_expression_parameter_fieldFormal_declaration() async {
312 addTestFile('''
313 class A {
314 /// The field documentation.
315 final int fff;
316 A({this.fff});
317 }
318 main() {
319 new A(fff: 42);
320 }
321 ''');
322 HoverInformation hover = await prepareHover('fff});');
323 expect(hover.containingLibraryName, isNull);
324 expect(hover.containingLibraryPath, isNull);
325 expect(hover.containingClassDescription, isNull);
326 expect(hover.dartdoc, 'The field documentation.');
327 expect(hover.elementDescription, '{int fff}');
328 expect(hover.elementKind, 'parameter');
329 expect(hover.staticType, 'int');
330 }
331
332 test_expression_parameter_fieldFormal_use() async {
333 addTestFile('''
334 class A {
335 /// The field documentation.
336 final int fff;
337 A({this.fff});
338 }
339 main() {
340 new A(fff: 42);
341 }
342 ''');
343 HoverInformation hover = await prepareHover('fff: 42');
344 expect(hover.containingLibraryName, isNull);
345 expect(hover.containingLibraryPath, isNull);
346 expect(hover.containingClassDescription, isNull);
347 expect(hover.dartdoc, 'The field documentation.');
348 expect(hover.elementDescription, '{int fff}');
349 expect(hover.elementKind, 'parameter');
350 expect(hover.staticType, 'int');
351 }
352
311 test_expression_syntheticGetter_invocation() async { 353 test_expression_syntheticGetter_invocation() async {
312 addTestFile(''' 354 addTestFile('''
313 library my.library; 355 library my.library;
314 class A { 356 class A {
315 /// doc aaa 357 /// doc aaa
316 /// doc bbb 358 /// doc bbb
317 String fff; 359 String fff;
318 } 360 }
319 main(A a) { 361 main(A a) {
320 print(a.fff); 362 print(a.fff);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 addTestFile(''' 522 addTestFile('''
481 library my.library; 523 library my.library;
482 main() { 524 main() {
483 // nothing 525 // nothing
484 } 526 }
485 '''); 527 ''');
486 HoverInformation hover = await prepareHover('nothing'); 528 HoverInformation hover = await prepareHover('nothing');
487 expect(hover, isNull); 529 expect(hover, isNull);
488 } 530 }
489 } 531 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698