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/context/context.dart'; | 10 import 'package:analyzer/src/context/context.dart'; |
11 import 'package:analyzer/src/generated/engine.dart'; | 11 import 'package:analyzer/src/generated/engine.dart'; |
12 import 'package:analyzer/src/generated/source.dart'; | 12 import 'package:analyzer/src/generated/source.dart'; |
13 import 'package:analyzer/src/task/options.dart'; | 13 import 'package:analyzer/src/task/options.dart'; |
14 import 'package:analyzer/task/general.dart'; | 14 import 'package:analyzer/task/general.dart'; |
15 import 'package:analyzer/task/model.dart'; | 15 import 'package:analyzer/task/model.dart'; |
| 16 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
16 import 'package:unittest/unittest.dart'; | 17 import 'package:unittest/unittest.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 '../../reflective_tests.dart'; | |
21 import '../../utils.dart'; | 21 import '../../utils.dart'; |
22 import '../context/abstract_context.dart'; | 22 import '../context/abstract_context.dart'; |
23 | 23 |
24 main() { | 24 main() { |
25 initializeTestEnvironment(); | 25 initializeTestEnvironment(); |
26 runReflectiveTests(ContextConfigurationTest); | 26 defineReflectiveTests(ContextConfigurationTest); |
27 runReflectiveTests(GenerateNewOptionsErrorsTaskTest); | 27 defineReflectiveTests(GenerateNewOptionsErrorsTaskTest); |
28 runReflectiveTests(GenerateOldOptionsErrorsTaskTest); | 28 defineReflectiveTests(GenerateOldOptionsErrorsTaskTest); |
29 runReflectiveTests(OptionsFileValidatorTest); | 29 defineReflectiveTests(OptionsFileValidatorTest); |
30 } | 30 } |
31 | 31 |
32 isInstanceOf isGenerateOptionsErrorsTask = | 32 isInstanceOf isGenerateOptionsErrorsTask = |
33 new isInstanceOf<GenerateOptionsErrorsTask>(); | 33 new isInstanceOf<GenerateOptionsErrorsTask>(); |
34 | 34 |
35 @reflectiveTest | 35 @reflectiveTest |
36 class ContextConfigurationTest extends AbstractContextTest { | 36 class ContextConfigurationTest extends AbstractContextTest { |
37 final AnalysisOptionsProvider optionsProvider = new AnalysisOptionsProvider(); | 37 final AnalysisOptionsProvider optionsProvider = new AnalysisOptionsProvider(); |
38 | 38 |
39 AnalysisOptions get analysisOptions => context.analysisOptions; | 39 AnalysisOptions get analysisOptions => context.analysisOptions; |
(...skipping 371 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
411 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); | 411 [AnalysisOptionsWarningCode.UNSUPPORTED_OPTION_WITH_LEGAL_VALUE]); |
412 } | 412 } |
413 | 413 |
414 void validate(String source, List<ErrorCode> expected) { | 414 void validate(String source, List<ErrorCode> expected) { |
415 var options = optionsProvider.getOptionsFromString(source); | 415 var options = optionsProvider.getOptionsFromString(source); |
416 var errors = validator.validate(options); | 416 var errors = validator.validate(options); |
417 expect(errors.map((AnalysisError e) => e.errorCode), | 417 expect(errors.map((AnalysisError e) => e.errorCode), |
418 unorderedEquals(expected)); | 418 unorderedEquals(expected)); |
419 } | 419 } |
420 } | 420 } |
OLD | NEW |