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.fixes; | 5 library test.edit.fixes; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import 'package:analysis_server/src/domain_analysis.dart'; | 9 import 'package:analysis_server/src/domain_analysis.dart'; |
10 import 'package:analysis_server/src/edit/edit_domain.dart'; | 10 import 'package:analysis_server/src/edit/edit_domain.dart'; |
11 import 'package:analysis_server/src/plugin/server_plugin.dart'; | |
12 import 'package:analysis_server/src/protocol.dart'; | 11 import 'package:analysis_server/src/protocol.dart'; |
13 import 'package:plugin/manager.dart'; | 12 import 'package:plugin/manager.dart'; |
14 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 13 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
15 import 'package:unittest/unittest.dart' hide ERROR; | 14 import 'package:unittest/unittest.dart' hide ERROR; |
16 | 15 |
17 import '../analysis_abstract.dart'; | 16 import '../analysis_abstract.dart'; |
18 import '../mocks.dart'; | 17 import '../mocks.dart'; |
19 | 18 |
20 main() { | 19 main() { |
21 groupSep = ' | '; | 20 groupSep = ' | '; |
22 defineReflectiveTests(FixesTest); | 21 defineReflectiveTests(FixesTest); |
23 } | 22 } |
24 | 23 |
25 @reflectiveTest | 24 @reflectiveTest |
26 class FixesTest extends AbstractAnalysisTest { | 25 class FixesTest extends AbstractAnalysisTest { |
27 @override | 26 @override |
28 void setUp() { | 27 void setUp() { |
29 super.setUp(); | 28 super.setUp(); |
30 createProject(); | 29 createProject(); |
31 ExtensionManager manager = new ExtensionManager(); | 30 ExtensionManager manager = new ExtensionManager(); |
32 ServerPlugin plugin = new ServerPlugin(); | 31 manager.processPlugins([server.serverPlugin]); |
33 manager.processPlugins([plugin]); | 32 handler = new EditDomainHandler(server); |
34 handler = new EditDomainHandler(server, plugin); | |
35 } | 33 } |
36 | 34 |
37 Future test_fixUndefinedClass() async { | 35 Future test_fixUndefinedClass() async { |
38 addTestFile(''' | 36 addTestFile(''' |
39 main() { | 37 main() { |
40 Future<String> x = null; | 38 Future<String> x = null; |
41 } | 39 } |
42 '''); | 40 '''); |
43 await waitForTasksFinished(); | 41 await waitForTasksFinished(); |
44 List<AnalysisErrorFixes> errorFixes = _getFixesAt('Future<String>'); | 42 List<AnalysisErrorFixes> errorFixes = _getFixesAt('Future<String>'); |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 return _getFixes(offset); | 108 return _getFixes(offset); |
111 } | 109 } |
112 | 110 |
113 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { | 111 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { |
114 AnalysisError error = fixes.error; | 112 AnalysisError error = fixes.error; |
115 expect(error.severity, AnalysisErrorSeverity.ERROR); | 113 expect(error.severity, AnalysisErrorSeverity.ERROR); |
116 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); | 114 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); |
117 expect(fixes.fixes, hasLength(1)); | 115 expect(fixes.fixes, hasLength(1)); |
118 } | 116 } |
119 } | 117 } |
OLD | NEW |