@@ -16,6 +16,7 @@ main() {
1616 defineReflectiveSuite (() {
1717 defineReflectiveTests (AnalysisOptionsProviderTest );
1818 });
19+
1920 group ('AnalysisOptionsProvider' , () {
2021 void expectMergesTo (String defaults, String overrides, String expected) {
2122 var optionsProvider = AnalysisOptionsProvider ();
@@ -212,65 +213,61 @@ analyzer:
212213 }
213214
214215 void test_getOptions_include () {
215- newFile ('/foo.include ' , r'''
216+ newFile ('/foo.yaml ' , r'''
216217analyzer:
217218 ignore:
218219 - ignoreme.dart
219220 - 'sdk_ext/**'
220221''' );
221222 newFile ('/$analysisOptionsYaml ' , r'''
222- include: foo.include
223+ include: foo.yaml
223224''' );
224- YamlMap options = _getOptions ('/' );
225+ var options = _getOptions ('/' );
225226 expect (options, hasLength (2 ));
226- {
227- var analyzer = options.valueAt ('analyzer' ) as YamlMap ;
228- expect (analyzer, hasLength (1 ));
229- {
230- var ignore = analyzer.valueAt ('ignore' ) as YamlList ;
231- expect (ignore, hasLength (2 ));
232- expect (ignore[0 ], 'ignoreme.dart' );
233- expect (ignore[1 ], 'sdk_ext/**' );
234- }
235- }
227+
228+ var analyzer = options.valueAt ('analyzer' ) as YamlMap ;
229+ expect (analyzer, hasLength (1 ));
230+
231+ var ignore = analyzer.valueAt ('ignore' ) as YamlList ;
232+ expect (ignore, hasLength (2 ));
233+ expect (ignore[0 ], 'ignoreme.dart' );
234+ expect (ignore[1 ], 'sdk_ext/**' );
236235 }
237236
238237 void test_getOptions_include_emptyLints () {
239- newFile ('/foo.include ' , r'''
238+ newFile ('/foo.yaml ' , r'''
240239linter:
241240 rules:
242241 - prefer_single_quotes
243242''' );
244243 newFile ('/$analysisOptionsYaml ' , r'''
245- include: foo.include
244+ include: foo.yaml
246245linter:
247246 rules:
248247 # avoid_print: false
249248''' );
250- YamlMap options = _getOptions ('/' );
249+ var options = _getOptions ('/' );
251250 expect (options, hasLength (2 ));
252- {
253- var linter = options.valueAt ('linter' ) as YamlMap ;
254- expect (linter, hasLength (1 ));
255- {
256- var rules = linter.valueAt ('rules' ) as YamlList ;
257- expect (rules, hasLength (1 ));
258- expect (rules[0 ], 'prefer_single_quotes' );
259- }
260- }
251+
252+ var linter = options.valueAt ('linter' ) as YamlMap ;
253+ expect (linter, hasLength (1 ));
254+
255+ var rules = linter.valueAt ('rules' ) as YamlList ;
256+ expect (rules, hasLength (1 ));
257+ expect (rules[0 ], 'prefer_single_quotes' );
261258 }
262259
263260 void test_getOptions_include_missing () {
264261 newFile ('/$analysisOptionsYaml ' , r'''
265- include: /foo.include
262+ include: /foo.yaml
266263''' );
267- YamlMap options = _getOptions ('/' );
264+ var options = _getOptions ('/' );
268265 expect (options, hasLength (1 ));
269266 }
270267
271268 void test_getOptions_invalid () {
272269 newFile ('/$analysisOptionsYaml ' , r''':''' );
273- YamlMap options = _getOptions ('/' );
270+ var options = _getOptions ('/' );
274271 expect (options, hasLength (1 ));
275272 }
276273
@@ -281,25 +278,21 @@ analyzer:
281278 - ignoreme.dart
282279 - 'sdk_ext/**'
283280''' );
284- YamlMap options = _getOptions ('/' );
281+ var options = _getOptions ('/' );
285282 expect (options, hasLength (1 ));
286- {
287- var analyzer = options.valueAt ('analyzer' ) as YamlMap ;
288- expect (analyzer, hasLength (1 ));
289- {
290- var ignore = analyzer.valueAt ('ignore' ) as YamlList ;
291- expect (ignore, hasLength (2 ));
292- expect (ignore[0 ], 'ignoreme.dart' );
293- expect (ignore[1 ], 'sdk_ext/**' );
294- }
295- }
283+
284+ var analyzer = options.valueAt ('analyzer' ) as YamlMap ;
285+ expect (analyzer, hasLength (1 ));
286+
287+ var ignore = analyzer.valueAt ('ignore' ) as YamlList ;
288+ expect (ignore, hasLength (2 ));
289+ expect (ignore[0 ], 'ignoreme.dart' );
290+ expect (ignore[1 ], 'sdk_ext/**' );
296291 }
297292
298293 YamlMap _getOptions (String posixPath) {
299294 var folder = getFolder (posixPath);
300- var provider = AnalysisOptionsProvider (SourceFactory ([
301- ResourceUriResolver (resourceProvider),
302- ]));
303- return provider.getOptions (folder);
295+ var sourceFactory = SourceFactory ([ResourceUriResolver (resourceProvider)]);
296+ return AnalysisOptionsProvider (sourceFactory).getOptions (folder);
304297 }
305298}
0 commit comments