Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: pkg/analyzer/test/src/context/builder_test.dart

Issue 2666693002: detect flutter and use default analysis options for flutter (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.context.context_builder_test; 5 library analyzer.test.src.context.context_builder_test;
6 6
7 import 'package:analyzer/file_system/file_system.dart'; 7 import 'package:analyzer/file_system/file_system.dart';
8 import 'package:analyzer/file_system/memory_file_system.dart'; 8 import 'package:analyzer/file_system/memory_file_system.dart';
9 import 'package:analyzer/src/command_line/arguments.dart'; 9 import 'package:analyzer/src/command_line/arguments.dart';
10 import 'package:analyzer/src/context/builder.dart'; 10 import 'package:analyzer/src/context/builder.dart';
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 ''' 555 '''
556 linter: 556 linter:
557 rules: 557 rules:
558 - mock_lint_rule2 558 - mock_lint_rule2
559 '''); 559 ''');
560 AnalysisOptions options = builder 560 AnalysisOptions options = builder
561 .getAnalysisOptions(resourceProvider.convertPath('/root/some/path')); 561 .getAnalysisOptions(resourceProvider.convertPath('/root/some/path'));
562 _expectEqualOptions(options, expected); 562 _expectEqualOptions(options, expected);
563 } 563 }
564 564
565 void test_getAnalysisOptions_default_flutter() {
566 MockLintRule mockLintRule = new MockLintRule('mock_lint_rule');
567 Registry.ruleRegistry.register(mockLintRule);
568 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
569 builderOptions.defaultOptions = defaultOptions;
570 AnalysisOptionsImpl expected = new AnalysisOptionsImpl();
571 expected.lint = true;
572 expected.lintRules = <Linter>[mockLintRule];
573 createFile(
574 resourceProvider.convertPath('/some/directory/path/.packages'),
575 '''
576 flutter:/pkg/flutter/lib/
577 ''');
578 createFile(
579 resourceProvider
580 .convertPath('/pkg/flutter/lib/analysis_options_user.yaml'),
581 '''
582 linter:
583 rules:
584 - mock_lint_rule
585 ''');
586 AnalysisOptions options = builder.getAnalysisOptions(
587 resourceProvider.convertPath('/some/directory/path'));
588 _expectEqualOptions(options, expected);
589 }
590
565 void test_getAnalysisOptions_default_noOverrides() { 591 void test_getAnalysisOptions_default_noOverrides() {
566 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); 592 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl();
567 defaultOptions.enableLazyAssignmentOperators = true; 593 defaultOptions.enableLazyAssignmentOperators = true;
568 builderOptions.defaultOptions = defaultOptions; 594 builderOptions.defaultOptions = defaultOptions;
569 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); 595 AnalysisOptionsImpl expected = new AnalysisOptionsImpl();
570 expected.enableLazyAssignmentOperators = true; 596 expected.enableLazyAssignmentOperators = true;
571 String path = resourceProvider.convertPath('/some/directory/path'); 597 String path = resourceProvider.convertPath('/some/directory/path');
572 String filePath = 598 String filePath =
573 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); 599 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
574 resourceProvider.newFile( 600 resourceProvider.newFile(
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
808 class MockLintRule implements LintRule { 834 class MockLintRule implements LintRule {
809 final String _name; 835 final String _name;
810 836
811 MockLintRule(this._name); 837 MockLintRule(this._name);
812 838
813 @override 839 @override
814 String get name => _name; 840 String get name => _name;
815 841
816 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 842 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
817 } 843 }
OLDNEW
« pkg/analyzer/lib/src/context/builder.dart ('K') | « pkg/analyzer/lib/src/generated/workspace.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698