| OLD | NEW |
| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:test/test.dart'; | 9 import 'package:test/test.dart'; |
| 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 10 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| (...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 expect(hover.elementDescription, 'mmm(int a, String b) → List<String>'); | 276 expect(hover.elementDescription, 'mmm(int a, String b) → List<String>'); |
| 277 expect(hover.elementKind, 'method'); | 277 expect(hover.elementKind, 'method'); |
| 278 expect(hover.isDeprecated, isFalse); | 278 expect(hover.isDeprecated, isFalse); |
| 279 // types | 279 // types |
| 280 expect(hover.staticType, '(int, String) → List<String>'); | 280 expect(hover.staticType, '(int, String) → List<String>'); |
| 281 expect(hover.propagatedType, isNull); | 281 expect(hover.propagatedType, isNull); |
| 282 // no parameter | 282 // no parameter |
| 283 expect(hover.parameter, isNull); | 283 expect(hover.parameter, isNull); |
| 284 } | 284 } |
| 285 | 285 |
| 286 test_expression_method_invocation_genericMethod() async { |
| 287 addTestFile(''' |
| 288 library my.library; |
| 289 |
| 290 abstract class Stream<T> { |
| 291 Stream<S> transform<S>(StreamTransformer<T, S> streamTransformer); |
| 292 } |
| 293 abstract class StreamTransformer<T, S> {} |
| 294 |
| 295 f(Stream<int> s) { |
| 296 s.transform(null); |
| 297 } |
| 298 '''); |
| 299 HoverInformation hover = await prepareHover('nsform(n'); |
| 300 // range |
| 301 expect(hover.offset, findOffset('transform(n')); |
| 302 expect(hover.length, 'transform'.length); |
| 303 // element |
| 304 expect(hover.containingLibraryName, 'my.library'); |
| 305 expect(hover.containingLibraryPath, testFile); |
| 306 expect(hover.elementDescription, |
| 307 'Stream.transform<S>(StreamTransformer<int, S> streamTransformer) → Stre
am<S>'); |
| 308 expect(hover.elementKind, 'method'); |
| 309 expect(hover.isDeprecated, isFalse); |
| 310 // types |
| 311 expect(hover.staticType, |
| 312 '(StreamTransformer<int, dynamic>) → Stream<dynamic>'); |
| 313 expect(hover.propagatedType, isNull); |
| 314 // no parameter |
| 315 expect(hover.parameter, isNull); |
| 316 } |
| 317 |
| 286 test_expression_parameter() async { | 318 test_expression_parameter() async { |
| 287 addTestFile(''' | 319 addTestFile(''' |
| 288 library my.library; | 320 library my.library; |
| 289 class A { | 321 class A { |
| 290 /// The method documentation. | 322 /// The method documentation. |
| 291 m(int p) { | 323 m(int p) { |
| 292 } | 324 } |
| 293 } | 325 } |
| 294 '''); | 326 '''); |
| 295 HoverInformation hover = await prepareHover('p) {'); | 327 HoverInformation hover = await prepareHover('p) {'); |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 521 addTestFile(''' | 553 addTestFile(''' |
| 522 library my.library; | 554 library my.library; |
| 523 main() { | 555 main() { |
| 524 // nothing | 556 // nothing |
| 525 } | 557 } |
| 526 '''); | 558 '''); |
| 527 HoverInformation hover = await prepareHover('nothing'); | 559 HoverInformation hover = await prepareHover('nothing'); |
| 528 expect(hover, isNull); | 560 expect(hover, isNull); |
| 529 } | 561 } |
| 530 } | 562 } |
| OLD | NEW |