| 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 test.src.task.options_test; | 5 library 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/src/generated/engine.dart' hide AnalysisContextImpl; | 9 import 'package:analyzer/src/generated/engine.dart' hide AnalysisContextImpl; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 expect(filters.any((filter) => filter(invalid_assignment_error)), isTrue); | 86 expect(filters.any((filter) => filter(invalid_assignment_error)), isTrue); |
| 87 } | 87 } |
| 88 | 88 |
| 89 test_configure_strong_mode() { | 89 test_configure_strong_mode() { |
| 90 configureContext(''' | 90 configureContext(''' |
| 91 analyzer: | 91 analyzer: |
| 92 strong-mode: true | 92 strong-mode: true |
| 93 '''); | 93 '''); |
| 94 expect(analysisOptions.strongMode, true); | 94 expect(analysisOptions.strongMode, true); |
| 95 } | 95 } |
| 96 |
| 97 test_configure_strong_mode_bad_value() { |
| 98 configureContext(''' |
| 99 analyzer: |
| 100 strong-mode: foo |
| 101 '''); |
| 102 expect(analysisOptions.strongMode, false); |
| 103 } |
| 104 |
| 105 test_configure_bad_options_contents() { |
| 106 configureContext(''' |
| 107 analyzer: |
| 108 strong-mode:true # misformatted |
| 109 '''); |
| 110 expect(analysisOptions.strongMode, false); |
| 111 } |
| 96 } | 112 } |
| 97 | 113 |
| 98 @reflectiveTest | 114 @reflectiveTest |
| 99 class GenerateOptionsErrorsTaskTest extends AbstractContextTest { | 115 class GenerateOptionsErrorsTaskTest extends AbstractContextTest { |
| 100 final optionsFilePath = '/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}'; | 116 final optionsFilePath = '/${AnalysisEngine.ANALYSIS_OPTIONS_FILE}'; |
| 101 | 117 |
| 102 Source source; | 118 Source source; |
| 103 LineInfo lineInfo(String source) => | 119 LineInfo lineInfo(String source) => |
| 104 GenerateOptionsErrorsTask.computeLineInfo(source); | 120 GenerateOptionsErrorsTask.computeLineInfo(source); |
| 105 | 121 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 315 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); | 331 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); |
| 316 } | 332 } |
| 317 | 333 |
| 318 void validate(String source, List<AnalysisOptionsErrorCode> expected) { | 334 void validate(String source, List<AnalysisOptionsErrorCode> expected) { |
| 319 var options = optionsProvider.getOptionsFromString(source); | 335 var options = optionsProvider.getOptionsFromString(source); |
| 320 var errors = validator.validate(options); | 336 var errors = validator.validate(options); |
| 321 expect(errors.map((AnalysisError e) => e.errorCode), | 337 expect(errors.map((AnalysisError e) => e.errorCode), |
| 322 unorderedEquals(expected)); | 338 unorderedEquals(expected)); |
| 323 } | 339 } |
| 324 } | 340 } |
| OLD | NEW |