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.edit.fix; | 5 library test.edit.fix; |
6 | 6 |
7 import 'package:analysis_server/src/computer/element.dart'; | 7 import 'package:analysis_server/src/computer/element.dart'; |
8 import 'package:analysis_server/src/computer/error.dart'; | 8 import 'package:analysis_server/src/computer/error.dart'; |
9 import 'package:analysis_server/src/edit/fix.dart'; | 9 import 'package:analysis_server/src/edit/fix.dart'; |
10 import 'package:analysis_services/constants.dart'; | 10 import 'package:analysis_services/constants.dart'; |
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 void test_fromService() { | 110 void test_fromService() { |
111 verifyNoTestUnitErrors = false; | 111 verifyNoTestUnitErrors = false; |
112 resolveTestUnit(''' | 112 resolveTestUnit(''' |
113 main() { | 113 main() { |
114 print(42) | 114 print(42) |
115 } | 115 } |
116 '''); | 116 '''); |
117 engine.AnalysisErrorInfo errors = context.getErrors(testSource); | 117 engine.AnalysisErrorInfo errors = context.getErrors(testSource); |
118 engine.AnalysisError engineError = errors.errors[0]; | 118 engine.AnalysisError engineError = errors.errors[0]; |
119 List<services.Fix> servicesFixes = | 119 List<services.Fix> servicesFixes = |
120 services.computeFixes(searchEngine, testFile, testUnit, engineError); | 120 services.computeFixes(searchEngine, testUnit, engineError); |
121 AnalysisError error = | 121 AnalysisError error = |
122 new AnalysisError.fromEngine(errors.lineInfo, engineError); | 122 new AnalysisError.fromEngine(errors.lineInfo, engineError); |
123 ErrorFixes fixes = new ErrorFixes(error); | 123 ErrorFixes fixes = new ErrorFixes(error); |
124 servicesFixes.forEach((fix) => fixes.addFix(fix)); | 124 servicesFixes.forEach((fix) => fixes.addFix(fix)); |
125 expect(fixes.toJson(), { | 125 expect(fixes.toJson(), { |
126 ERROR: { | 126 ERROR: { |
127 SEVERITY: 'ERROR', | 127 SEVERITY: 'ERROR', |
128 TYPE: 'SYNTACTIC_ERROR', | 128 TYPE: 'SYNTACTIC_ERROR', |
129 LOCATION: { | 129 LOCATION: { |
130 FILE: '/test.dart', | 130 FILE: '/test.dart', |
(...skipping 12 matching lines...) Expand all Loading... |
143 OFFSET: 20, | 143 OFFSET: 20, |
144 LENGTH: 0, | 144 LENGTH: 0, |
145 REPLACEMENT: ';' | 145 REPLACEMENT: ';' |
146 }] | 146 }] |
147 }], | 147 }], |
148 LINKED_POSITION_GROUPS: [] | 148 LINKED_POSITION_GROUPS: [] |
149 }] | 149 }] |
150 }); | 150 }); |
151 } | 151 } |
152 } | 152 } |
OLD | NEW |