| 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 29 matching lines...) Expand all Loading... |
| 40 ['x'] | 40 ['x'] |
| 41 ]); | 41 ]); |
| 42 | 42 |
| 43 initializeTestEnvironment(); | 43 initializeTestEnvironment(); |
| 44 oneTimeSetup(); | 44 oneTimeSetup(); |
| 45 | 45 |
| 46 setUp(() { | 46 setUp(() { |
| 47 context = new TestContext(); | 47 context = new TestContext(); |
| 48 }); | 48 }); |
| 49 | 49 |
| 50 group('ErrorProcessorTest', () { | 50 group('ErrorProcessor', () { |
| 51 test('configureOptions', () { | 51 test('configureOptions', () { |
| 52 configureOptions(''' | 52 configureOptions(''' |
| 53 analyzer: | 53 analyzer: |
| 54 errors: | 54 errors: |
| 55 invalid_assignment: error # severity ERROR | 55 invalid_assignment: error # severity ERROR |
| 56 missing_return: false # ignore | 56 missing_return: false # ignore |
| 57 unused_local_variable: true # skipped | 57 unused_local_variable: true # skipped |
| 58 use_of_void_result: unsupported_action # skipped | 58 use_of_void_result: unsupported_action # skipped |
| 59 '''); | 59 '''); |
| 60 expect(getProcessor(invalid_assignment).severity, ErrorSeverity.ERROR); | 60 expect(getProcessor(invalid_assignment).severity, ErrorSeverity.ERROR); |
| 61 expect(getProcessor(missing_return).severity, isNull); | 61 expect(getProcessor(missing_return).severity, isNull); |
| 62 expect(getProcessor(unused_local_variable), isNull); | 62 expect(getProcessor(unused_local_variable), isNull); |
| 63 expect(getProcessor(use_of_void_result), isNull); | 63 expect(getProcessor(use_of_void_result), isNull); |
| 64 }); | 64 }); |
| 65 |
| 66 test('upgrades static type warnings to errors in strong mode', () { |
| 67 configureOptions(''' |
| 68 analyzer: |
| 69 strong-mode: true |
| 70 '''); |
| 71 expect(getProcessor(invalid_assignment).severity, ErrorSeverity.ERROR); |
| 72 }); |
| 65 }); | 73 }); |
| 66 | 74 |
| 67 group('ErrorConfigTest', () { | 75 group('ErrorConfig', () { |
| 68 var config = ''' | 76 var config = ''' |
| 69 analyzer: | 77 analyzer: |
| 70 errors: | 78 errors: |
| 71 invalid_assignment: unsupported_action # should be skipped | 79 invalid_assignment: unsupported_action # should be skipped |
| 72 missing_return: false | 80 missing_return: false |
| 73 unused_local_variable: error | 81 unused_local_variable: error |
| 74 '''; | 82 '''; |
| 75 | 83 |
| 76 group('processing', () { | 84 group('processing', () { |
| 77 test('yaml map', () { | 85 test('yaml map', () { |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 141 void oneTimeSetup() { | 149 void oneTimeSetup() { |
| 142 List<Plugin> plugins = <Plugin>[]; | 150 List<Plugin> plugins = <Plugin>[]; |
| 143 plugins.addAll(AnalysisEngine.instance.requiredPlugins); | 151 plugins.addAll(AnalysisEngine.instance.requiredPlugins); |
| 144 plugins.add(AnalysisEngine.instance.commandLinePlugin); | 152 plugins.add(AnalysisEngine.instance.commandLinePlugin); |
| 145 plugins.add(AnalysisEngine.instance.optionsPlugin); | 153 plugins.add(AnalysisEngine.instance.optionsPlugin); |
| 146 ExtensionManager manager = new ExtensionManager(); | 154 ExtensionManager manager = new ExtensionManager(); |
| 147 manager.processPlugins(plugins); | 155 manager.processPlugins(plugins); |
| 148 } | 156 } |
| 149 | 157 |
| 150 class TestContext extends AnalysisContextImpl {} | 158 class TestContext extends AnalysisContextImpl {} |
| OLD | NEW |