| 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/edit/edit_domain.dart'; | 9 import 'package:analysis_server/src/edit/edit_domain.dart'; |
| 10 import 'package:analysis_server/src/plugin/server_plugin.dart'; |
| 10 import 'package:analysis_server/src/protocol.dart'; | 11 import 'package:analysis_server/src/protocol.dart'; |
| 12 import 'package:analyzer/src/plugin/plugin_impl.dart'; |
| 11 import 'package:unittest/unittest.dart' hide ERROR; | 13 import 'package:unittest/unittest.dart' hide ERROR; |
| 12 | 14 |
| 13 import '../analysis_abstract.dart'; | 15 import '../analysis_abstract.dart'; |
| 14 import '../reflective_tests.dart'; | 16 import '../reflective_tests.dart'; |
| 15 | 17 |
| 16 main() { | 18 main() { |
| 17 groupSep = ' | '; | 19 groupSep = ' | '; |
| 18 runReflectiveTests(FixesTest); | 20 runReflectiveTests(FixesTest); |
| 19 } | 21 } |
| 20 | 22 |
| 21 @reflectiveTest | 23 @reflectiveTest |
| 22 class FixesTest extends AbstractAnalysisTest { | 24 class FixesTest extends AbstractAnalysisTest { |
| 23 @override | 25 @override |
| 24 void setUp() { | 26 void setUp() { |
| 25 super.setUp(); | 27 super.setUp(); |
| 26 createProject(); | 28 createProject(); |
| 27 handler = new EditDomainHandler(server); | 29 ExtensionManager manager = new ExtensionManager(); |
| 30 ServerPlugin plugin = new ServerPlugin(); |
| 31 manager.processPlugins([plugin]); |
| 32 handler = new EditDomainHandler(server, plugin); |
| 28 } | 33 } |
| 29 | 34 |
| 30 Future test_fixUndefinedClass() { | 35 Future test_fixUndefinedClass() { |
| 31 addTestFile(''' | 36 addTestFile(''' |
| 32 main() { | 37 main() { |
| 33 Future<String> x = null; | 38 Future<String> x = null; |
| 34 } | 39 } |
| 35 '''); | 40 '''); |
| 36 return waitForTasksFinished().then((_) { | 41 return waitForTasksFinished().then((_) { |
| 37 List<AnalysisErrorFixes> errorFixes = _getFixesAt('Future<String>'); | 42 List<AnalysisErrorFixes> errorFixes = _getFixesAt('Future<String>'); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return _getFixes(offset); | 89 return _getFixes(offset); |
| 85 } | 90 } |
| 86 | 91 |
| 87 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { | 92 void _isSyntacticErrorWithSingleFix(AnalysisErrorFixes fixes) { |
| 88 AnalysisError error = fixes.error; | 93 AnalysisError error = fixes.error; |
| 89 expect(error.severity, AnalysisErrorSeverity.ERROR); | 94 expect(error.severity, AnalysisErrorSeverity.ERROR); |
| 90 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); | 95 expect(error.type, AnalysisErrorType.SYNTACTIC_ERROR); |
| 91 expect(fixes.fixes, hasLength(1)); | 96 expect(fixes.fixes, hasLength(1)); |
| 92 } | 97 } |
| 93 } | 98 } |
| OLD | NEW |