| 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'; |
| 11 import 'package:analyzer/src/generated/source.dart'; | 11 import 'package:analyzer/src/generated/source.dart'; |
| 12 import 'package:analyzer/src/task/options.dart'; | 12 import 'package:analyzer/src/task/options.dart'; |
| 13 import 'package:analyzer/task/general.dart'; | 13 import 'package:analyzer/task/general.dart'; |
| 14 import 'package:analyzer/task/model.dart'; | 14 import 'package:analyzer/task/model.dart'; |
| 15 import 'package:linter/src/rules.dart'; |
| 15 import 'package:test/test.dart'; | 16 import 'package:test/test.dart'; |
| 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 17 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 17 import 'package:yaml/yaml.dart'; | 18 import 'package:yaml/yaml.dart'; |
| 18 | 19 |
| 19 import '../../generated/test_support.dart'; | 20 import '../../generated/test_support.dart'; |
| 20 import '../context/abstract_context.dart'; | 21 import '../context/abstract_context.dart'; |
| 21 | 22 |
| 22 main() { | 23 main() { |
| 23 defineReflectiveSuite(() { | 24 defineReflectiveSuite(() { |
| 24 defineReflectiveTests(ContextConfigurationTest); | 25 defineReflectiveTests(ContextConfigurationTest); |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 test_analyzer_unsupported_option() { | 437 test_analyzer_unsupported_option() { |
| 437 validate( | 438 validate( |
| 438 ''' | 439 ''' |
| 439 analyzer: | 440 analyzer: |
| 440 not_supported: true | 441 not_supported: true |
| 441 ''', | 442 ''', |
| 442 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES]); | 443 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUES]); |
| 443 } | 444 } |
| 444 | 445 |
| 445 test_linter_supported_rules() { | 446 test_linter_supported_rules() { |
| 447 registerLintRules(); |
| 446 validate( | 448 validate( |
| 447 ''' | 449 ''' |
| 448 linter: | 450 linter: |
| 449 rules: | 451 rules: |
| 450 - camel_case_types | 452 - camel_case_types |
| 451 ''', | 453 ''', |
| 452 []); | 454 []); |
| 453 } | 455 } |
| 454 | 456 |
| 455 test_linter_unsupported_option() { | 457 test_linter_unsupported_option() { |
| 456 validate( | 458 validate( |
| 457 ''' | 459 ''' |
| 458 linter: | 460 linter: |
| 459 unsupported: true | 461 unsupported: true |
| 460 ''', | 462 ''', |
| 461 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); | 463 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); |
| 462 } | 464 } |
| 463 | 465 |
| 464 void validate(String source, List<ErrorCode> expected) { | 466 void validate(String source, List<ErrorCode> expected) { |
| 465 var options = optionsProvider.getOptionsFromString(source); | 467 var options = optionsProvider.getOptionsFromString(source); |
| 466 var errors = validator.validate(options); | 468 var errors = validator.validate(options); |
| 467 expect(errors.map((AnalysisError e) => e.errorCode), | 469 expect(errors.map((AnalysisError e) => e.errorCode), |
| 468 unorderedEquals(expected)); | 470 unorderedEquals(expected)); |
| 469 } | 471 } |
| 470 } | 472 } |
| OLD | NEW |