| 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'; |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 standardAnalysisSetup(); | 143 standardAnalysisSetup(); |
| 144 | 144 |
| 145 // Note: analysis.getHover doesn't wait for analysis to complete--it simply | 145 // Note: analysis.getHover doesn't wait for analysis to complete--it simply |
| 146 // returns the latest results that are available at the time that the | 146 // returns the latest results that are available at the time that the |
| 147 // request is made. So wait for analysis to finish before testing anything. | 147 // request is made. So wait for analysis to finish before testing anything. |
| 148 return analysisFinished.then((_) { | 148 return analysisFinished.then((_) { |
| 149 List<Future> tests = []; | 149 List<Future> tests = []; |
| 150 tests.add(checkHover('topLevelVar;', 11, ['List', 'topLevelVar'], | 150 tests.add(checkHover('topLevelVar;', 11, ['List', 'topLevelVar'], |
| 151 'top level variable', ['List'])); | 151 'top level variable', ['List'])); |
| 152 tests.add(checkHover( | 152 tests.add(checkHover( |
| 153 'func(', 4, ['func', 'int', 'param'], 'function', ['int', 'void'], | 153 'func(', 4, ['func', 'int', 'param'], 'function', null, |
| 154 docRegexp: 'Documentation for func')); | 154 docRegexp: 'Documentation for func')); |
| 155 tests.add(checkHover('int param', 3, ['int'], 'class', ['int'], | 155 tests.add(checkHover('int param', 3, ['int'], 'class', null, |
| 156 isCore: true, docRegexp: '.*')); | 156 isCore: true, docRegexp: '.*')); |
| 157 tests.add(checkHover('param)', 5, ['int', 'param'], 'parameter', ['int'], | 157 tests.add(checkHover('param)', 5, ['int', 'param'], 'parameter', ['int'], |
| 158 isLocal: true, docRegexp: 'Documentation for func')); | 158 isLocal: true, docRegexp: 'Documentation for func')); |
| 159 tests.add(checkHover('num localVar', 3, ['num'], 'class', ['num'], | 159 tests.add(checkHover('num localVar', 3, ['num'], 'class', null, |
| 160 isCore: true, docRegexp: '.*')); | 160 isCore: true, docRegexp: '.*')); |
| 161 tests.add(checkHover( | 161 tests.add(checkHover( |
| 162 'localVar =', 8, ['num', 'localVar'], 'local variable', ['num'], | 162 'localVar =', 8, ['num', 'localVar'], 'local variable', ['num'], |
| 163 isLocal: true, propagatedType: 'int')); | 163 isLocal: true, propagatedType: 'int')); |
| 164 tests.add(checkHover('topLevelVar.length;', 11, ['List', 'topLevelVar'], | 164 tests.add(checkHover('topLevelVar.length;', 11, ['List', 'topLevelVar'], |
| 165 'top level variable', ['List'])); | 165 'top level variable', ['List'])); |
| 166 tests.add(checkHover( | 166 tests.add(checkHover( |
| 167 'length;', 6, ['get', 'length', 'int'], 'getter', ['int'], | 167 'length;', 6, ['get', 'length', 'int'], 'getter', null, |
| 168 isCore: true, docRegexp: '.*')); | 168 isCore: true, docRegexp: '.*')); |
| 169 tests.add(checkHover( | 169 tests.add(checkHover( |
| 170 'length =', 6, ['set', 'length', 'int'], 'setter', ['int'], | 170 'length =', 6, ['set', 'length', 'int'], 'setter', null, |
| 171 isCore: true, docRegexp: '.*')); | 171 isCore: true, docRegexp: '.*')); |
| 172 tests.add(checkHover('param;', 5, ['int', 'param'], 'parameter', ['int'], | 172 tests.add(checkHover('param;', 5, ['int', 'param'], 'parameter', ['int'], |
| 173 isLocal: true, | 173 isLocal: true, |
| 174 docRegexp: 'Documentation for func', | 174 docRegexp: 'Documentation for func', |
| 175 parameterRegexps: ['.*'])); | 175 parameterRegexps: ['.*'])); |
| 176 tests.add(checkHover('add(', 3, ['List', 'add'], 'method', null, | 176 tests.add(checkHover('add(', 3, ['List', 'add'], 'method', null, |
| 177 isCore: true, docRegexp: '.*')); | 177 isCore: true, docRegexp: '.*')); |
| 178 tests.add(checkHover( | 178 tests.add(checkHover( |
| 179 'localVar)', 8, ['num', 'localVar'], 'local variable', ['num'], | 179 'localVar)', 8, ['num', 'localVar'], 'local variable', ['num'], |
| 180 isLocal: true, parameterRegexps: ['.*'], propagatedType: 'int')); | 180 isLocal: true, parameterRegexps: ['.*'], propagatedType: 'int')); |
| 181 tests.add(checkHover( | 181 tests.add(checkHover( |
| 182 'func(35', 4, ['func', 'int', 'param'], 'function', null, | 182 'func(35', 4, ['func', 'int', 'param'], 'function', null, |
| 183 docRegexp: 'Documentation for func')); | 183 docRegexp: 'Documentation for func')); |
| 184 tests.add(checkHover('35', 2, null, null, ['int'], | 184 tests.add(checkHover('35', 2, null, null, ['int'], |
| 185 isLiteral: true, parameterRegexps: ['int', 'param'])); | 185 isLiteral: true, parameterRegexps: ['int', 'param'])); |
| 186 tests.add(checkNoHover('comment')); | 186 tests.add(checkNoHover('comment')); |
| 187 return Future.wait(tests); | 187 return Future.wait(tests); |
| 188 }); | 188 }); |
| 189 } | 189 } |
| 190 } | 190 } |
| OLD | NEW |