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.source.analysis_options_provider_test; | 5 library analyzer.test.source.analysis_options_provider_test; |
6 | 6 |
7 import 'dart:core'; | 7 import 'dart:core'; |
8 | 8 |
9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 | 187 |
188 void test_getOptions_empty() { | 188 void test_getOptions_empty() { |
189 pathTranslator.newFile('/$optionsFileName', r'''#empty'''); | 189 pathTranslator.newFile('/$optionsFileName', r'''#empty'''); |
190 Map<String, YamlNode> options = _getOptions('/'); | 190 Map<String, YamlNode> options = _getOptions('/'); |
191 expect(options, isNotNull); | 191 expect(options, isNotNull); |
192 expect(options, isEmpty); | 192 expect(options, isEmpty); |
193 } | 193 } |
194 | 194 |
195 void test_getOptions_include() { | 195 void test_getOptions_include() { |
196 if (isWindows) { | |
197 // TODO(danrubel) fix on Windows. | |
198 return; | |
199 } | |
200 pathTranslator.newFile( | 196 pathTranslator.newFile( |
201 '/foo.include', | 197 '/foo.include', |
202 r''' | 198 r''' |
203 analyzer: | 199 analyzer: |
204 ignore: | 200 ignore: |
205 - ignoreme.dart | 201 - ignoreme.dart |
206 - 'sdk_ext/**' | 202 - 'sdk_ext/**' |
207 '''); | 203 '''); |
208 pathTranslator.newFile( | 204 pathTranslator.newFile( |
209 '/$optionsFileName', | 205 '/$optionsFileName', |
210 r''' | 206 r''' |
211 include: /foo.include | 207 include: foo.include |
212 '''); | 208 '''); |
213 Map<String, YamlNode> options = _getOptions('/'); | 209 Map<String, YamlNode> options = _getOptions('/'); |
214 expect(options, hasLength(1)); | 210 expect(options, hasLength(1)); |
215 { | 211 { |
216 YamlMap analyzer = options['analyzer']; | 212 YamlMap analyzer = options['analyzer']; |
217 expect(analyzer, hasLength(1)); | 213 expect(analyzer, hasLength(1)); |
218 { | 214 { |
219 YamlList ignore = analyzer['ignore']; | 215 YamlList ignore = analyzer['ignore']; |
220 expect(ignore, hasLength(2)); | 216 expect(ignore, hasLength(2)); |
221 expect(ignore[0], 'ignoreme.dart'); | 217 expect(ignore[0], 'ignoreme.dart'); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 expect(ignore[1], 'sdk_ext/**'); | 258 expect(ignore[1], 'sdk_ext/**'); |
263 } | 259 } |
264 } | 260 } |
265 } | 261 } |
266 | 262 |
267 Map<String, YamlNode> _getOptions(String posixPath, {bool crawlUp: false}) { | 263 Map<String, YamlNode> _getOptions(String posixPath, {bool crawlUp: false}) { |
268 Resource resource = pathTranslator.getResource(posixPath); | 264 Resource resource = pathTranslator.getResource(posixPath); |
269 return provider.getOptions(resource, crawlUp: crawlUp); | 265 return provider.getOptions(resource, crawlUp: crawlUp); |
270 } | 266 } |
271 } | 267 } |
OLD | NEW |