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 'dart:mirrors'; | 7 import 'dart:mirrors'; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart'; | 9 import 'package:analyzer/analyzer.dart'; |
10 import 'package:analyzer/source/analysis_options_provider.dart'; | 10 import 'package:analyzer/source/analysis_options_provider.dart'; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 analyzer: | 120 analyzer: |
121 exclude: | 121 exclude: |
122 - foo/bar.dart | 122 - foo/bar.dart |
123 - 'test/**' | 123 - 'test/**' |
124 '''); | 124 '''); |
125 | 125 |
126 List<String> excludes = analysisOptions.excludePatterns; | 126 List<String> excludes = analysisOptions.excludePatterns; |
127 expect(excludes, unorderedEquals(['foo/bar.dart', 'test/**'])); | 127 expect(excludes, unorderedEquals(['foo/bar.dart', 'test/**'])); |
128 } | 128 } |
129 | 129 |
| 130 test_configure_plugins_list() { |
| 131 configureContext(''' |
| 132 analyzer: |
| 133 plugins: |
| 134 - angular2 |
| 135 - intl |
| 136 '''); |
| 137 |
| 138 List<String> names = analysisOptions.enabledPluginNames; |
| 139 expect(names, ['angular2', 'intl']); |
| 140 } |
| 141 |
| 142 test_configure_plugins_map() { |
| 143 configureContext(''' |
| 144 analyzer: |
| 145 plugins: |
| 146 angular2: |
| 147 enabled: true |
| 148 '''); |
| 149 |
| 150 List<String> names = analysisOptions.enabledPluginNames; |
| 151 expect(names, ['angular2']); |
| 152 } |
| 153 |
| 154 test_configure_plugins_string() { |
| 155 configureContext(''' |
| 156 analyzer: |
| 157 plugins: |
| 158 angular2 |
| 159 '''); |
| 160 |
| 161 List<String> names = analysisOptions.enabledPluginNames; |
| 162 expect(names, ['angular2']); |
| 163 } |
| 164 |
130 test_configure_strong_mode() { | 165 test_configure_strong_mode() { |
131 configureContext(''' | 166 configureContext(''' |
132 analyzer: | 167 analyzer: |
133 strong-mode: true | 168 strong-mode: true |
134 '''); | 169 '''); |
135 expect(analysisOptions.strongMode, true); | 170 expect(analysisOptions.strongMode, true); |
136 } | 171 } |
137 | 172 |
138 test_configure_strong_mode_bad_value() { | 173 test_configure_strong_mode_bad_value() { |
139 configureContext(''' | 174 configureContext(''' |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
559 var options = optionsProvider.getOptionsFromString(source); | 594 var options = optionsProvider.getOptionsFromString(source); |
560 var errors = validator.validate(options); | 595 var errors = validator.validate(options); |
561 expect(errors.map((AnalysisError e) => e.errorCode), | 596 expect(errors.map((AnalysisError e) => e.errorCode), |
562 unorderedEquals(expected)); | 597 unorderedEquals(expected)); |
563 } | 598 } |
564 } | 599 } |
565 | 600 |
566 class TestRule extends LintRule { | 601 class TestRule extends LintRule { |
567 TestRule() : super(name: 'fantastic_test_rule'); | 602 TestRule() : super(name: 'fantastic_test_rule'); |
568 } | 603 } |
OLD | NEW |