| 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 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 'reflective_tests.dart'; | |
| 11 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
| 12 | 11 |
| 13 import 'analysis_abstract.dart'; | 12 import '../analysis_abstract.dart'; |
| 13 import '../reflective_tests.dart'; |
| 14 | 14 |
| 15 | 15 |
| 16 main() { | 16 main() { |
| 17 groupSep = ' | '; | 17 groupSep = ' | '; |
| 18 runReflectiveTests(AnalysisHoverTest); | 18 runReflectiveTests(AnalysisHoverTest); |
| 19 } | 19 } |
| 20 | 20 |
| 21 | 21 |
| 22 @ReflectiveTestCase() | 22 @ReflectiveTestCase() |
| 23 class AnalysisHoverTest extends AbstractAnalysisTest { | 23 class AnalysisHoverTest extends AbstractAnalysisTest { |
| 24 Future<HoverInformation> prepareHover(String search) { | 24 Future<HoverInformation> prepareHover(String search) { |
| 25 int offset = findOffset(search); | 25 int offset = findOffset(search); |
| 26 return prepareHoverAt(offset); | 26 return prepareHoverAt(offset); |
| 27 } | 27 } |
| 28 | 28 |
| 29 Future<HoverInformation> prepareHoverAt(int offset) { | 29 Future<HoverInformation> prepareHoverAt(int offset) { |
| 30 return waitForTasksFinished().then((_) { | 30 return waitForTasksFinished().then((_) { |
| 31 Request request = new AnalysisGetHoverParams(testFile, | 31 Request request = |
| 32 offset).toRequest('0'); | 32 new AnalysisGetHoverParams(testFile, offset).toRequest('0'); |
| 33 Response response = handleSuccessfulRequest(request); | 33 Response response = handleSuccessfulRequest(request); |
| 34 var result = new AnalysisGetHoverResult.fromResponse(response); | 34 var result = new AnalysisGetHoverResult.fromResponse(response); |
| 35 List<HoverInformation> hovers = result.hovers; | 35 List<HoverInformation> hovers = result.hovers; |
| 36 return hovers.isNotEmpty ? hovers.first : null; | 36 return hovers.isNotEmpty ? hovers.first : null; |
| 37 }); | 37 }); |
| 38 } | 38 } |
| 39 | 39 |
| 40 @override | 40 @override |
| 41 void setUp() { | 41 void setUp() { |
| 42 super.setUp(); | 42 super.setUp(); |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 217 library my.library; | 217 library my.library; |
| 218 main() { | 218 main() { |
| 219 // nothing | 219 // nothing |
| 220 } | 220 } |
| 221 '''); | 221 '''); |
| 222 return prepareHover('nothing').then((HoverInformation hover) { | 222 return prepareHover('nothing').then((HoverInformation hover) { |
| 223 expect(hover, isNull); | 223 expect(hover, isNull); |
| 224 }); | 224 }); |
| 225 } | 225 } |
| 226 } | 226 } |
| OLD | NEW |