| OLD | NEW |
| 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/source/package_map_resolver.dart'; | 9 import 'package:analyzer/source/package_map_resolver.dart'; |
| 10 import 'package:analyzer/src/command_line/arguments.dart'; | 10 import 'package:analyzer/src/command_line/arguments.dart'; |
| (...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 _expectEqualOptions(options, expected); | 715 _expectEqualOptions(options, expected); |
| 716 } | 716 } |
| 717 | 717 |
| 718 void test_getAnalysisOptions_default_flutter() { | 718 void test_getAnalysisOptions_default_flutter() { |
| 719 _defineMockLintRules(); | 719 _defineMockLintRules(); |
| 720 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); | 720 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 721 builderOptions.defaultOptions = defaultOptions; | 721 builderOptions.defaultOptions = defaultOptions; |
| 722 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); | 722 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); |
| 723 expected.lint = true; | 723 expected.lint = true; |
| 724 expected.lintRules = <Linter>[_mockLintRule]; | 724 expected.lintRules = <Linter>[_mockLintRule]; |
| 725 String packagesFilePath = |
| 726 resourceProvider.convertPath('/some/directory/path/.packages'); |
| 727 createFile(packagesFilePath, 'flutter:/pkg/flutter/lib/'); |
| 728 String optionsFilePath = resourceProvider |
| 729 .convertPath('/pkg/flutter/lib/analysis_options_user.yaml'); |
| 725 createFile( | 730 createFile( |
| 726 resourceProvider.convertPath('/some/directory/path/.packages'), | 731 optionsFilePath, |
| 727 ''' | |
| 728 flutter:/pkg/flutter/lib/ | |
| 729 '''); | |
| 730 createFile( | |
| 731 resourceProvider | |
| 732 .convertPath('/pkg/flutter/lib/analysis_options_user.yaml'), | |
| 733 ''' | 732 ''' |
| 734 linter: | 733 linter: |
| 735 rules: | 734 rules: |
| 736 - mock_lint_rule | 735 - mock_lint_rule |
| 737 '''); | 736 '''); |
| 738 AnalysisOptions options = builder.getAnalysisOptions( | 737 String projPath = resourceProvider.convertPath('/some/directory/path'); |
| 739 resourceProvider.convertPath('/some/directory/path')); | 738 AnalysisOptions options = builder.getAnalysisOptions(projPath); |
| 740 // TODO(danrubel) fix on Windows | 739 _expectEqualOptions(options, expected); |
| 741 if (resourceProvider.absolutePathContext.separator != r'\') { | |
| 742 _expectEqualOptions(options, expected); | |
| 743 } | |
| 744 } | 740 } |
| 745 | 741 |
| 746 void test_getAnalysisOptions_default_noOverrides() { | 742 void test_getAnalysisOptions_default_noOverrides() { |
| 747 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); | 743 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 748 defaultOptions.enableLazyAssignmentOperators = true; | 744 defaultOptions.enableLazyAssignmentOperators = true; |
| 749 builderOptions.defaultOptions = defaultOptions; | 745 builderOptions.defaultOptions = defaultOptions; |
| 750 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); | 746 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); |
| 751 expected.enableLazyAssignmentOperators = true; | 747 expected.enableLazyAssignmentOperators = true; |
| 752 String path = resourceProvider.convertPath('/some/directory/path'); | 748 String path = resourceProvider.convertPath('/some/directory/path'); |
| 753 String filePath = | 749 String filePath = |
| (...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1013 class _MockLintRule implements LintRule { | 1009 class _MockLintRule implements LintRule { |
| 1014 final String _name; | 1010 final String _name; |
| 1015 | 1011 |
| 1016 _MockLintRule(this._name); | 1012 _MockLintRule(this._name); |
| 1017 | 1013 |
| 1018 @override | 1014 @override |
| 1019 String get name => _name; | 1015 String get name => _name; |
| 1020 | 1016 |
| 1021 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 1017 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 1022 } | 1018 } |
| OLD | NEW |