| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 analyzer.test.source.error_processor; | 5 library analyzer.test.source.error_processor; |
| 6 | 6 |
| 7 import 'package:analyzer/source/analysis_options_provider.dart'; | 7 import 'package:analyzer/source/analysis_options_provider.dart'; |
| 8 import 'package:analyzer/source/error_processor.dart'; | 8 import 'package:analyzer/source/error_processor.dart'; |
| 9 import 'package:analyzer/src/context/context.dart'; | 9 import 'package:analyzer/src/context/context.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 analyzer: | 88 analyzer: |
| 89 errors: | 89 errors: |
| 90 invalid_assignment: unsupported_action # should be skipped | 90 invalid_assignment: unsupported_action # should be skipped |
| 91 missing_return: false | 91 missing_return: false |
| 92 unused_local_variable: error | 92 unused_local_variable: error |
| 93 '''; | 93 '''; |
| 94 | 94 |
| 95 group('processing', () { | 95 group('processing', () { |
| 96 test('yaml map', () { | 96 test('yaml map', () { |
| 97 var options = optionsProvider.getOptionsFromString(config); | 97 var options = optionsProvider.getOptionsFromString(config); |
| 98 var errorConfig = new ErrorConfig(options['analyzer']['errors']); | 98 var errorConfig = |
| 99 new ErrorConfig((options['analyzer'] as YamlMap)['errors']); |
| 99 expect(errorConfig.processors, hasLength(2)); | 100 expect(errorConfig.processors, hasLength(2)); |
| 100 | 101 |
| 101 // ignore | 102 // ignore |
| 102 var missingReturnProcessor = errorConfig.processors | 103 var missingReturnProcessor = errorConfig.processors |
| 103 .firstWhere((p) => p.appliesTo(missing_return)); | 104 .firstWhere((p) => p.appliesTo(missing_return)); |
| 104 expect(missingReturnProcessor.severity, isNull); | 105 expect(missingReturnProcessor.severity, isNull); |
| 105 | 106 |
| 106 // error | 107 // error |
| 107 var unusedLocalProcessor = errorConfig.processors | 108 var unusedLocalProcessor = errorConfig.processors |
| 108 .firstWhere((p) => p.appliesTo(unused_local_variable)); | 109 .firstWhere((p) => p.appliesTo(unused_local_variable)); |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 void oneTimeSetup() { | 161 void oneTimeSetup() { |
| 161 List<Plugin> plugins = <Plugin>[]; | 162 List<Plugin> plugins = <Plugin>[]; |
| 162 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 163 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
| 163 plugins.add(AnalysisEngine.instance.commandLinePlugin); | 164 plugins.add(AnalysisEngine.instance.commandLinePlugin); |
| 164 plugins.add(AnalysisEngine.instance.optionsPlugin); | 165 plugins.add(AnalysisEngine.instance.optionsPlugin); |
| 165 ExtensionManager manager = new ExtensionManager(); | 166 ExtensionManager manager = new ExtensionManager(); |
| 166 manager.processPlugins(plugins); | 167 manager.processPlugins(plugins); |
| 167 } | 168 } |
| 168 | 169 |
| 169 class TestContext extends AnalysisContextImpl {} | 170 class TestContext extends AnalysisContextImpl {} |
| OLD | NEW |