| 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'; | 9 import 'package:analyzer/src/generated/engine.dart'; |
| 10 import 'package:analyzer/src/generated/source.dart'; | 10 import 'package:analyzer/src/generated/source.dart'; |
| 11 import 'package:analyzer/src/task/options.dart'; | 11 import 'package:analyzer/src/task/options.dart'; |
| 12 import 'package:analyzer/task/general.dart'; |
| 12 import 'package:analyzer/task/model.dart'; | 13 import 'package:analyzer/task/model.dart'; |
| 13 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
| 14 | 15 |
| 15 import '../../generated/test_support.dart'; | 16 import '../../generated/test_support.dart'; |
| 16 import '../../reflective_tests.dart'; | 17 import '../../reflective_tests.dart'; |
| 17 import '../../utils.dart'; | 18 import '../../utils.dart'; |
| 18 import '../context/abstract_context.dart'; | 19 import '../context/abstract_context.dart'; |
| 19 | 20 |
| 20 main() { | 21 main() { |
| 21 initializeTestEnvironment(); | 22 initializeTestEnvironment(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 87 |
| 87 test_perform_OK() { | 88 test_perform_OK() { |
| 88 String code = r''' | 89 String code = r''' |
| 89 analyzer: | 90 analyzer: |
| 90 strong-mode: true | 91 strong-mode: true |
| 91 '''; | 92 '''; |
| 92 AnalysisTarget target = newSource(optionsFilePath, code); | 93 AnalysisTarget target = newSource(optionsFilePath, code); |
| 93 computeResult(target, ANALYSIS_OPTIONS_ERRORS); | 94 computeResult(target, ANALYSIS_OPTIONS_ERRORS); |
| 94 expect(task, isGenerateOptionsErrorsTask); | 95 expect(task, isGenerateOptionsErrorsTask); |
| 95 expect(outputs[ANALYSIS_OPTIONS_ERRORS], isEmpty); | 96 expect(outputs[ANALYSIS_OPTIONS_ERRORS], isEmpty); |
| 97 LineInfo lineInfo = outputs[LINE_INFO]; |
| 98 expect(lineInfo, isNotNull); |
| 99 expect(lineInfo.getLocation(1).lineNumber, 1); |
| 100 expect(lineInfo.getLocation(10).lineNumber, 2); |
| 96 } | 101 } |
| 97 | 102 |
| 98 test_perform_unsupported_analyzer_option() { | 103 test_perform_unsupported_analyzer_option() { |
| 99 String code = r''' | 104 String code = r''' |
| 100 analyzer: | 105 analyzer: |
| 101 not_supported: true | 106 not_supported: true |
| 102 '''; | 107 '''; |
| 103 AnalysisTarget target = newSource(optionsFilePath, code); | 108 AnalysisTarget target = newSource(optionsFilePath, code); |
| 104 computeResult(target, ANALYSIS_OPTIONS_ERRORS); | 109 computeResult(target, ANALYSIS_OPTIONS_ERRORS); |
| 105 expect(task, isGenerateOptionsErrorsTask); | 110 expect(task, isGenerateOptionsErrorsTask); |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION]); | 169 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION]); |
| 165 } | 170 } |
| 166 | 171 |
| 167 void validate(String source, List<AnalysisOptionsErrorCode> expected) { | 172 void validate(String source, List<AnalysisOptionsErrorCode> expected) { |
| 168 var options = optionsProvider.getOptionsFromString(source); | 173 var options = optionsProvider.getOptionsFromString(source); |
| 169 var errors = validator.validate(options); | 174 var errors = validator.validate(options); |
| 170 expect(errors.map((AnalysisError e) => e.errorCode), | 175 expect(errors.map((AnalysisError e) => e.errorCode), |
| 171 unorderedEquals(expected)); | 176 unorderedEquals(expected)); |
| 172 } | 177 } |
| 173 } | 178 } |
| OLD | NEW |