| 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 | 60 |
| 61 test_configure_enableAsync_false() { | 61 test_configure_enableAsync_false() { |
| 62 configureContext(''' | 62 configureContext(''' |
| 63 analyzer: | 63 analyzer: |
| 64 language: | 64 language: |
| 65 enableAsync: false | 65 enableAsync: false |
| 66 '''); | 66 '''); |
| 67 expect(analysisOptions.enableAsync, false); | 67 expect(analysisOptions.enableAsync, false); |
| 68 } | 68 } |
| 69 | 69 |
| 70 test_configure_enableGenericMethods() { | |
| 71 expect(analysisOptions.enableGenericMethods, false); | |
| 72 configureContext(''' | |
| 73 analyzer: | |
| 74 language: | |
| 75 enableGenericMethods: true | |
| 76 '''); | |
| 77 expect(analysisOptions.enableGenericMethods, true); | |
| 78 } | |
| 79 | |
| 80 test_configure_enableConditionalDirectives() { | 70 test_configure_enableConditionalDirectives() { |
| 81 expect(analysisOptions.enableConditionalDirectives, false); | 71 expect(analysisOptions.enableConditionalDirectives, false); |
| 82 configureContext(''' | 72 configureContext(''' |
| 83 analyzer: | 73 analyzer: |
| 84 language: | 74 language: |
| 85 enableConditionalDirectives: true | 75 enableConditionalDirectives: true |
| 86 '''); | 76 '''); |
| 87 expect(analysisOptions.enableConditionalDirectives, true); | 77 expect(analysisOptions.enableConditionalDirectives, true); |
| 88 } | 78 } |
| 89 | 79 |
| 90 test_configure_enableSuperMixins() { | 80 test_configure_enableGenericMethods() { |
| 81 expect(analysisOptions.enableGenericMethods, false); |
| 91 configureContext(''' | 82 configureContext(''' |
| 92 analyzer: | 83 analyzer: |
| 93 language: | 84 language: |
| 94 enableSuperMixins: true | 85 enableGenericMethods: true |
| 95 '''); | 86 '''); |
| 96 expect(analysisOptions.enableSuperMixins, true); | 87 expect(analysisOptions.enableGenericMethods, true); |
| 97 } | 88 } |
| 98 | 89 |
| 99 test_configure_enableStrictCallChecks() { | 90 test_configure_enableStrictCallChecks() { |
| 100 configureContext(''' | 91 configureContext(''' |
| 101 analyzer: | 92 analyzer: |
| 102 language: | 93 language: |
| 103 enableStrictCallChecks: true | 94 enableStrictCallChecks: true |
| 104 '''); | 95 '''); |
| 105 expect(analysisOptions.enableStrictCallChecks, true); | 96 expect(analysisOptions.enableStrictCallChecks, true); |
| 106 } | 97 } |
| 107 | 98 |
| 99 test_configure_enableSuperMixins() { |
| 100 configureContext(''' |
| 101 analyzer: |
| 102 language: |
| 103 enableSuperMixins: true |
| 104 '''); |
| 105 expect(analysisOptions.enableSuperMixins, true); |
| 106 } |
| 107 |
| 108 test_configure_error_processors() { | 108 test_configure_error_processors() { |
| 109 configureContext(''' | 109 configureContext(''' |
| 110 analyzer: | 110 analyzer: |
| 111 errors: | 111 errors: |
| 112 invalid_assignment: ignore | 112 invalid_assignment: ignore |
| 113 unused_local_variable: error | 113 unused_local_variable: error |
| 114 '''); | 114 '''); |
| 115 | 115 |
| 116 List<ErrorProcessor> processors = | 116 List<ErrorProcessor> processors = |
| 117 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS); | 117 context.getConfigurationData(CONFIGURED_ERROR_PROCESSORS); |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 396 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); | 396 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); |
| 397 } | 397 } |
| 398 | 398 |
| 399 void validate(String source, List<AnalysisOptionsErrorCode> expected) { | 399 void validate(String source, List<AnalysisOptionsErrorCode> expected) { |
| 400 var options = optionsProvider.getOptionsFromString(source); | 400 var options = optionsProvider.getOptionsFromString(source); |
| 401 var errors = validator.validate(options); | 401 var errors = validator.validate(options); |
| 402 expect(errors.map((AnalysisError e) => e.errorCode), | 402 expect(errors.map((AnalysisError e) => e.errorCode), |
| 403 unorderedEquals(expected)); | 403 unorderedEquals(expected)); |
| 404 } | 404 } |
| 405 } | 405 } |
| OLD | NEW |