| 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:analysis_server/protocol/protocol.dart'; | 7 import 'package:analysis_server/protocol/protocol.dart'; |
| 8 import 'package:analysis_server/protocol/protocol_generated.dart'; | 8 import 'package:analysis_server/protocol/protocol_generated.dart'; |
| 9 import 'package:analysis_server/src/edit/edit_domain.dart'; | 9 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| 10 import 'package:analysis_server/src/plugin/plugin_manager.dart'; | 10 import 'package:analysis_server/src/plugin/plugin_manager.dart'; |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 } | 54 } |
| 55 | 55 |
| 56 test_fromPlugins() async { | 56 test_fromPlugins() async { |
| 57 PluginInfo info = new DiscoveredPluginInfo('a', 'b', 'c', null, null); | 57 PluginInfo info = new DiscoveredPluginInfo('a', 'b', 'c', null, null); |
| 58 plugin.AnalysisErrorFixes fixes = new plugin.AnalysisErrorFixes( | 58 plugin.AnalysisErrorFixes fixes = new plugin.AnalysisErrorFixes( |
| 59 new AnalysisError(AnalysisErrorSeverity.ERROR, AnalysisErrorType.HINT, | 59 new AnalysisError(AnalysisErrorSeverity.ERROR, AnalysisErrorType.HINT, |
| 60 new Location('', 0, 0, 0, 0), 'message', 'code')); | 60 new Location('', 0, 0, 0, 0), 'message', 'code')); |
| 61 plugin.EditGetFixesResult result = | 61 plugin.EditGetFixesResult result = |
| 62 new plugin.EditGetFixesResult(<plugin.AnalysisErrorFixes>[fixes]); | 62 new plugin.EditGetFixesResult(<plugin.AnalysisErrorFixes>[fixes]); |
| 63 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ | 63 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ |
| 64 info: new Future.value(result.toResponse('-')) | 64 info: new Future.value(result.toResponse('-', 1)) |
| 65 }; | 65 }; |
| 66 | 66 |
| 67 createProject(); | 67 createProject(); |
| 68 addTestFile('main() {}'); | 68 addTestFile('main() {}'); |
| 69 await waitForTasksFinished(); | 69 await waitForTasksFinished(); |
| 70 List<AnalysisErrorFixes> errorFixes = await _getFixesAt('in('); | 70 List<AnalysisErrorFixes> errorFixes = await _getFixesAt('in('); |
| 71 expect(errorFixes, hasLength(1)); | 71 expect(errorFixes, hasLength(1)); |
| 72 } | 72 } |
| 73 | 73 |
| 74 test_hasFixes() async { | 74 test_hasFixes() async { |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 return await _getFixes(offset); | 158 return await _getFixes(offset); |
| 159 } | 159 } |
| 160 | 160 |
| 161 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { | 161 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { |
| 162 AnalysisError error = fixes.error; | 162 AnalysisError error = fixes.error; |
| 163 expect(error.severity, AnalysisErrorSeverity.ERROR); | 163 expect(error.severity, AnalysisErrorSeverity.ERROR); |
| 164 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); | 164 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); |
| 165 expect(fixes.fixes, hasLength(1)); | 165 expect(fixes.fixes, hasLength(1)); |
| 166 } | 166 } |
| 167 } | 167 } |
| OLD | NEW |