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.integration.analysis.get.hover; | 5 library test.integration.analysis.get.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:path/path.dart'; | 10 import 'package:path/path.dart' as path; |
11 import 'package:test/test.dart'; | 11 import 'package:test/test.dart'; |
12 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 12 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
13 | 13 |
14 import '../integration_tests.dart'; | 14 import '../integration_tests.dart'; |
15 | 15 |
16 main() { | 16 main() { |
17 defineReflectiveSuite(() { | 17 defineReflectiveSuite(() { |
18 defineReflectiveTests(AnalysisGetHoverIntegrationTest); | 18 defineReflectiveTests(AnalysisGetHoverIntegrationTest); |
19 }); | 19 }); |
20 } | 20 } |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 bool isLiteral: false, | 71 bool isLiteral: false, |
72 List<String> parameterRegexps: null, | 72 List<String> parameterRegexps: null, |
73 propagatedType: null}) { | 73 propagatedType: null}) { |
74 int offset = text.indexOf(target); | 74 int offset = text.indexOf(target); |
75 return sendAnalysisGetHover(pathname, offset).then((result) { | 75 return sendAnalysisGetHover(pathname, offset).then((result) { |
76 expect(result.hovers, hasLength(1)); | 76 expect(result.hovers, hasLength(1)); |
77 HoverInformation info = result.hovers[0]; | 77 HoverInformation info = result.hovers[0]; |
78 expect(info.offset, equals(offset)); | 78 expect(info.offset, equals(offset)); |
79 expect(info.length, equals(length)); | 79 expect(info.length, equals(length)); |
80 if (isCore) { | 80 if (isCore) { |
81 expect(basename(info.containingLibraryPath), equals('core.dart')); | 81 expect(path.basename(info.containingLibraryPath), equals('core.dart')); |
82 expect(info.containingLibraryName, equals('dart.core')); | 82 expect(info.containingLibraryName, equals('dart.core')); |
83 } else if (isLocal || isLiteral) { | 83 } else if (isLocal || isLiteral) { |
84 expect(info.containingLibraryPath, isNull); | 84 expect(info.containingLibraryPath, isNull); |
85 expect(info.containingLibraryName, isNull); | 85 expect(info.containingLibraryName, isNull); |
86 } else { | 86 } else { |
87 expect(info.containingLibraryPath, equals(pathname)); | 87 expect(info.containingLibraryPath, equals(pathname)); |
88 expect(info.containingLibraryName, equals('lib.test')); | 88 expect(info.containingLibraryName, equals('lib.test')); |
89 } | 89 } |
90 if (docRegexp == null) { | 90 if (docRegexp == null) { |
91 expect(info.dartdoc, isNull); | 91 expect(info.dartdoc, isNull); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 tests.add(checkHover( | 182 tests.add(checkHover( |
183 'func(35', 4, ['func', 'int', 'param'], 'function', ['int', 'void'], | 183 'func(35', 4, ['func', 'int', 'param'], 'function', ['int', 'void'], |
184 docRegexp: 'Documentation for func')); | 184 docRegexp: 'Documentation for func')); |
185 tests.add(checkHover('35', 2, null, null, ['int'], | 185 tests.add(checkHover('35', 2, null, null, ['int'], |
186 isLiteral: true, parameterRegexps: ['int', 'param'])); | 186 isLiteral: true, parameterRegexps: ['int', 'param'])); |
187 tests.add(checkNoHover('comment')); | 187 tests.add(checkNoHover('comment')); |
188 return Future.wait(tests); | 188 return Future.wait(tests); |
189 }); | 189 }); |
190 } | 190 } |
191 } | 191 } |
OLD | NEW |