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

Side by Side Diff: pkg/analysis_server/test/integration/analysis_domain_inttest.dart

Issue 407443002: Fix analysis server 'analysis.getHover' when there is no hover information. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « pkg/analysis_server/test/analysis_hover_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.integration.analysis.domain; 5 library test.integration.analysis.domain;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/constants.dart'; 9 import 'package:analysis_server/src/constants.dart';
10 import 'package:analysis_testing/reflective_tests.dart'; 10 import 'package:analysis_testing/reflective_tests.dart';
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 tests.add(testHover('localVar)', 8, ['num', 'localVar'], 'local variable', 129 tests.add(testHover('localVar)', 8, ['num', 'localVar'], 'local variable',
130 ['num'], parameterRegexps: ['.*'], propagatedType: 'int')); 130 ['num'], parameterRegexps: ['.*'], propagatedType: 'int'));
131 tests.add(testHover('func(35', 4, ['func', 'int', 'param'], 'function', 131 tests.add(testHover('func(35', 4, ['func', 'int', 'param'], 'function',
132 null, docRegexp: 'Documentation for func')); 132 null, docRegexp: 'Documentation for func'));
133 tests.add(testHover('35', 2, null, null, ['int'], isLiteral: true, 133 tests.add(testHover('35', 2, null, null, ['int'], isLiteral: true,
134 parameterRegexps: ['int', 'param'])); 134 parameterRegexps: ['int', 'param']));
135 return Future.wait(tests); 135 return Future.wait(tests);
136 }); 136 });
137 } 137 }
138 138
139 fail_test_getHover_noInfo() { 139 test_getHover_noInfo() {
140 String filename = 'test.dart'; 140 String filename = 'test.dart';
141 String pathname = normalizePath(filename); 141 String pathname = normalizePath(filename);
142 String text = 142 String text =
143 r''' 143 r'''
144 main() { 144 main() {
145 // no code 145 // no code
146 } 146 }
147 '''; 147 ''';
148 writeFile(filename, text); 148 writeFile(filename, text);
149 setAnalysisRoots(['']); 149 setAnalysisRoots(['']);
150 150
151 // Note: analysis.getHover doesn't wait for analysis to complete--it simply 151 // Note: analysis.getHover doesn't wait for analysis to complete--it simply
152 // returns the latest results that are available at the time that the 152 // returns the latest results that are available at the time that the
153 // request is made. So wait for analysis to finish before testing anything. 153 // request is made. So wait for analysis to finish before testing anything.
154 return analysisFinished.then((_) { 154 return analysisFinished.then((_) {
155 return server.send(ANALYSIS_GET_HOVER, { 155 return server.send(ANALYSIS_GET_HOVER, {
156 'file': pathname, 156 'file': pathname,
157 'offset': text.indexOf('no code') 157 'offset': text.indexOf('no code')
158 }).then((result) { 158 }).then((result) {
159 expect(result, isAnalysisGetHoverResult); 159 expect(result, isAnalysisGetHoverResult);
160 expect(result['hovers'], hasLength(0)); 160 expect(result['hovers'], hasLength(0));
161 }); 161 });
162 }); 162 });
163 } 163 }
164 } 164 }
165 165
166 main() { 166 main() {
167 runReflectiveTests(AnalysisDomainIntegrationTest); 167 runReflectiveTests(AnalysisDomainIntegrationTest);
168 } 168 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/analysis_hover_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698