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

Side by Side Diff: pkg/analysis_server/test/edit/fixes_test.dart

Issue 2879273002: Make server use the common protocol classes (Closed)
Patch Set: Created 3 years, 7 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
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 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';
11 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin; 11 import 'package:analyzer_plugin/protocol/protocol.dart' as plugin;
12 import 'package:analyzer_plugin/protocol/protocol_common.dart' as plugin; 12 import 'package:analyzer_plugin/protocol/protocol_common.dart';
13 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin; 13 import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
14 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin; 14 import 'package:analyzer_plugin/src/protocol/protocol_internal.dart' as plugin;
15 import 'package:plugin/manager.dart'; 15 import 'package:plugin/manager.dart';
16 import 'package:test/test.dart'; 16 import 'package:test/test.dart';
17 import 'package:test_reflective_loader/test_reflective_loader.dart'; 17 import 'package:test_reflective_loader/test_reflective_loader.dart';
18 18
19 import '../analysis_abstract.dart'; 19 import '../analysis_abstract.dart';
20 20
21 main() { 21 main() {
22 defineReflectiveSuite(() { 22 defineReflectiveSuite(() {
(...skipping 26 matching lines...) Expand all
49 expect(error.type, AnalysisErrorType.STATIC_WARNING); 49 expect(error.type, AnalysisErrorType.STATIC_WARNING);
50 List<SourceChange> fixes = errorFixes[0].fixes; 50 List<SourceChange> fixes = errorFixes[0].fixes;
51 expect(fixes, hasLength(2)); 51 expect(fixes, hasLength(2));
52 expect(fixes[0].message, matches('Import library')); 52 expect(fixes[0].message, matches('Import library'));
53 expect(fixes[1].message, matches('Create class')); 53 expect(fixes[1].message, matches('Create class'));
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 plugin.AnalysisError( 59 new AnalysisError(AnalysisErrorSeverity.ERROR, AnalysisErrorType.HINT,
60 plugin.AnalysisErrorSeverity.ERROR, 60 new Location('', 0, 0, 0, 0), 'message', 'code'));
61 plugin.AnalysisErrorType.HINT,
62 new plugin.Location('', 0, 0, 0, 0),
63 'message',
64 'code'));
65 plugin.EditGetFixesResult result = 61 plugin.EditGetFixesResult result =
66 new plugin.EditGetFixesResult(<plugin.AnalysisErrorFixes>[fixes]); 62 new plugin.EditGetFixesResult(<plugin.AnalysisErrorFixes>[fixes]);
67 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{ 63 pluginManager.broadcastResults = <PluginInfo, Future<plugin.Response>>{
68 info: new Future.value(result.toResponse('-')) 64 info: new Future.value(result.toResponse('-'))
69 }; 65 };
70 66
71 createProject(); 67 createProject();
72 addTestFile('main() {}'); 68 addTestFile('main() {}');
73 await waitForTasksFinished(); 69 await waitForTasksFinished();
74 List<AnalysisErrorFixes> errorFixes = await _getFixesAt('in('); 70 List<AnalysisErrorFixes> errorFixes = await _getFixesAt('in(');
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 return await _getFixes(offset); 158 return await _getFixes(offset);
163 } 159 }
164 160
165 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { 161 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) {
166 AnalysisError error = fixes.error; 162 AnalysisError error = fixes.error;
167 expect(error.severity, AnalysisErrorSeverity.ERROR); 163 expect(error.severity, AnalysisErrorSeverity.ERROR);
168 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); 164 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR);
169 expect(fixes.fixes, hasLength(1)); 165 expect(fixes.fixes, hasLength(1));
170 } 166 }
171 } 167 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/test/edit/assists_test.dart ('k') | pkg/analysis_server/test/edit/format_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698