| Index: pkg/analysis_server/test/analysis_hover_test.dart
|
| diff --git a/pkg/analysis_server/test/analysis_hover_test.dart b/pkg/analysis_server/test/analysis_hover_test.dart
|
| index 1dfdf614e3380f85c8eb913f8481dbb749c72a80..ef7a403b2d6695187b300f883a1404563ec98c03 100644
|
| --- a/pkg/analysis_server/test/analysis_hover_test.dart
|
| +++ b/pkg/analysis_server/test/analysis_hover_test.dart
|
| @@ -6,8 +6,6 @@ library test.domain.analysis.hover;
|
|
|
| import 'dart:async';
|
|
|
| -import 'package:analysis_server/src/computer/computer_hover.dart';
|
| -import 'package:analysis_server/src/constants.dart';
|
| import 'package:analysis_server/src/protocol.dart';
|
| import 'package:analysis_server/src/protocol2.dart';
|
| import 'package:analysis_testing/reflective_tests.dart';
|
| @@ -24,20 +22,18 @@ main() {
|
|
|
| @ReflectiveTestCase()
|
| class AnalysisHoverTest extends AbstractAnalysisTest {
|
| - Future<Hover> prepareHover(String search) {
|
| + Future<HoverInformation> prepareHover(String search) {
|
| int offset = findOffset(search);
|
| return prepareHoverAt(offset);
|
| }
|
|
|
| - Future<Hover> prepareHoverAt(int offset) {
|
| + Future<HoverInformation> prepareHoverAt(int offset) {
|
| return waitForTasksFinished().then((_) {
|
| Request request = new AnalysisGetHoverParams(testFile,
|
| offset).toRequest('0');
|
| Response response = handleSuccessfulRequest(request);
|
| - List<Map<String, Object>> hoverJsons = response.getResult(HOVERS);
|
| - List<Hover> hovers = hoverJsons.map((json) {
|
| - return new Hover.fromJson(json);
|
| - }).toList();
|
| + var result = new AnalysisGetHoverResult.fromResponse(response);
|
| + List<HoverInformation> hovers = result.hovers;
|
| return hovers.isNotEmpty ? hovers.first : null;
|
| });
|
| }
|
| @@ -48,7 +44,7 @@ class AnalysisHoverTest extends AbstractAnalysisTest {
|
| createProject();
|
| }
|
|
|
| - test_dartDoc_clunky() {
|
| + test_dartdoc_clunky() {
|
| addTestFile('''
|
| library my.library;
|
| /**
|
| @@ -58,12 +54,12 @@ library my.library;
|
| main() {
|
| }
|
| ''');
|
| - return prepareHover('main() {').then((Hover hover) {
|
| - expect(hover.dartDoc, '''doc aaa\ndoc bbb''');
|
| + return prepareHover('main() {').then((HoverInformation hover) {
|
| + expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
|
| });
|
| }
|
|
|
| - test_dartDoc_elegant() {
|
| + test_dartdoc_elegant() {
|
| addTestFile('''
|
| library my.library;
|
| /// doc aaa
|
| @@ -71,8 +67,8 @@ library my.library;
|
| main() {
|
| }
|
| ''');
|
| - return prepareHover('main() {').then((Hover hover) {
|
| - expect(hover.dartDoc, '''doc aaa\ndoc bbb''');
|
| + return prepareHover('main() {').then((HoverInformation hover) {
|
| + expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
|
| });
|
| }
|
|
|
| @@ -84,11 +80,11 @@ library my.library;
|
| List<String> fff(int a, String b) {
|
| }
|
| ''');
|
| - return prepareHover('fff(int a').then((Hover hover) {
|
| + return prepareHover('fff(int a').then((HoverInformation hover) {
|
| // element
|
| expect(hover.containingLibraryName, 'my.library');
|
| expect(hover.containingLibraryPath, testFile);
|
| - expect(hover.dartDoc, '''doc aaa\ndoc bbb''');
|
| + expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
|
| expect(hover.elementDescription, 'fff(int a, String b) → List<String>');
|
| expect(hover.elementKind, 'function');
|
| // types
|
| @@ -106,7 +102,7 @@ main() {
|
| }
|
| foo(Object myParameter) {}
|
| ''');
|
| - return prepareHover('123').then((Hover hover) {
|
| + return prepareHover('123').then((HoverInformation hover) {
|
| // literal, no Element
|
| expect(hover.elementDescription, isNull);
|
| expect(hover.elementKind, isNull);
|
| @@ -128,11 +124,11 @@ class A {
|
| }
|
| }
|
| ''');
|
| - return prepareHover('mmm(int a').then((Hover hover) {
|
| + return prepareHover('mmm(int a').then((HoverInformation hover) {
|
| // element
|
| expect(hover.containingLibraryName, 'my.library');
|
| expect(hover.containingLibraryPath, testFile);
|
| - expect(hover.dartDoc, '''doc aaa\ndoc bbb''');
|
| + expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
|
| expect(hover.elementDescription, 'A.mmm(int a, String b) → List<String>');
|
| expect(hover.elementKind, 'method');
|
| // types
|
| @@ -154,7 +150,7 @@ main(A a) {
|
| a.mmm(42, 'foo');
|
| }
|
| ''');
|
| - return prepareHover('mm(42, ').then((Hover hover) {
|
| + return prepareHover('mm(42, ').then((HoverInformation hover) {
|
| // range
|
| expect(hover.offset, findOffset('mmm(42, '));
|
| expect(hover.length, 'mmm'.length);
|
| @@ -183,11 +179,11 @@ main(A a) {
|
| print(a.fff);
|
| }
|
| ''');
|
| - return prepareHover('fff);').then((Hover hover) {
|
| + return prepareHover('fff);').then((HoverInformation hover) {
|
| // element
|
| expect(hover.containingLibraryName, 'my.library');
|
| expect(hover.containingLibraryPath, testFile);
|
| - expect(hover.dartDoc, '''doc aaa\ndoc bbb''');
|
| + expect(hover.dartdoc, '''doc aaa\ndoc bbb''');
|
| expect(hover.elementDescription, 'String fff');
|
| expect(hover.elementKind, 'field');
|
| // types
|
| @@ -204,11 +200,11 @@ main() {
|
| print(vvv);
|
| }
|
| ''');
|
| - return prepareHover('vvv);').then((Hover hover) {
|
| + return prepareHover('vvv);').then((HoverInformation hover) {
|
| // element
|
| expect(hover.containingLibraryName, 'my.library');
|
| expect(hover.containingLibraryPath, testFile);
|
| - expect(hover.dartDoc, isNull);
|
| + expect(hover.dartdoc, isNull);
|
| expect(hover.elementDescription, 'dynamic vvv');
|
| expect(hover.elementKind, 'local variable');
|
| // types
|
| @@ -224,7 +220,7 @@ main() {
|
| // nothing
|
| }
|
| ''');
|
| - return prepareHover('nothing').then((Hover hover) {
|
| + return prepareHover('nothing').then((HoverInformation hover) {
|
| expect(hover, isNull);
|
| });
|
| }
|
|
|