| 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.src.task.options_test; | 5 library analyzer.test.src.task.options_test; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart'; | 7 import 'package:analyzer/analyzer.dart'; |
| 8 import 'package:analyzer/source/analysis_options_provider.dart'; | 8 import 'package:analyzer/source/analysis_options_provider.dart'; |
| 9 import 'package:analyzer/source/error_processor.dart'; | 9 import 'package:analyzer/source/error_processor.dart'; |
| 10 import 'package:analyzer/src/generated/engine.dart'; | 10 import 'package:analyzer/src/generated/engine.dart'; |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 test_configure_error_processors() { | 99 test_configure_error_processors() { |
| 100 configureContext(''' | 100 configureContext(''' |
| 101 analyzer: | 101 analyzer: |
| 102 errors: | 102 errors: |
| 103 invalid_assignment: ignore | 103 invalid_assignment: ignore |
| 104 unused_local_variable: error | 104 unused_local_variable: error |
| 105 '''); | 105 '''); |
| 106 | 106 |
| 107 List<ErrorProcessor> processors = | 107 List<ErrorProcessor> processors = |
| 108 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS) | 108 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS); |
| 109 as List<ErrorProcessor>; | |
| 110 expect(processors, hasLength(2)); | 109 expect(processors, hasLength(2)); |
| 111 | 110 |
| 112 var unused_local = new AnalysisError( | 111 var unused_local = new AnalysisError( |
| 113 new TestSource(), 0, 1, HintCode.UNUSED_LOCAL_VARIABLE, [ | 112 new TestSource(), 0, 1, HintCode.UNUSED_LOCAL_VARIABLE, [ |
| 114 ['x'] | 113 ['x'] |
| 115 ]); | 114 ]); |
| 116 var invalid_assignment = | 115 var invalid_assignment = |
| 117 new AnalysisError(new TestSource(), 0, 1, HintCode.INVALID_ASSIGNMENT, [ | 116 new AnalysisError(new TestSource(), 0, 1, HintCode.INVALID_ASSIGNMENT, [ |
| 118 ['x'], | 117 ['x'], |
| 119 ['y'] | 118 ['y'] |
| (...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 399 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); | 398 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); |
| 400 } | 399 } |
| 401 | 400 |
| 402 void validate(String source, List<ErrorCode> expected) { | 401 void validate(String source, List<ErrorCode> expected) { |
| 403 var options = optionsProvider.getOptionsFromString(source); | 402 var options = optionsProvider.getOptionsFromString(source); |
| 404 var errors = validator.validate(options); | 403 var errors = validator.validate(options); |
| 405 expect(errors.map((AnalysisError e) => e.errorCode), | 404 expect(errors.map((AnalysisError e) => e.errorCode), |
| 406 unorderedEquals(expected)); | 405 unorderedEquals(expected)); |
| 407 } | 406 } |
| 408 } | 407 } |
| OLD | NEW |