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