| 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 print('>>> packages: $packagesFilePath'); | |
| 728 createFile(packagesFilePath, 'flutter:/pkg/flutter/lib/'); | |
| 729 String optionsFilePath = resourceProvider | |
| 730 .convertPath('/pkg/flutter/lib/analysis_options_user.yaml'); | |
| 731 print('>>> options: $optionsFilePath'); | |
| 732 createFile( | 725 createFile( |
| 733 optionsFilePath, | 726 resourceProvider.convertPath('/some/directory/path/.packages'), |
| 727 ''' |
| 728 flutter:/pkg/flutter/lib/ |
| 729 '''); |
| 730 createFile( |
| 731 resourceProvider |
| 732 .convertPath('/pkg/flutter/lib/analysis_options_user.yaml'), |
| 734 ''' | 733 ''' |
| 735 linter: | 734 linter: |
| 736 rules: | 735 rules: |
| 737 - mock_lint_rule | 736 - mock_lint_rule |
| 738 '''); | 737 '''); |
| 739 String projPath = resourceProvider.convertPath('/some/directory/path'); | 738 AnalysisOptions options = builder.getAnalysisOptions( |
| 740 AnalysisOptions options = builder.getAnalysisOptions(projPath); | 739 resourceProvider.convertPath('/some/directory/path')); |
| 741 // TODO(danrubel) fix on Windows | 740 // TODO(danrubel) fix on Windows |
| 742 if (resourceProvider.absolutePathContext.separator != r'\') { | 741 if (resourceProvider.absolutePathContext.separator != r'\') { |
| 743 _expectEqualOptions(options, expected); | 742 _expectEqualOptions(options, expected); |
| 744 } else { | |
| 745 // echo some debugging information | |
| 746 print('>>> projPath: $projPath'); | |
| 747 print('>>> ${builderOptions.defaultAnalysisOptionsFilePath}'); | |
| 748 print('>>> getOptionsFile: ${builder.getOptionsFile(projPath)}'); | |
| 749 _expectEqualOptions(options, expected); | |
| 750 fail('>>>>>>> Fail to echo test output on bots <<<<<<<'); | |
| 751 } | 743 } |
| 752 } | 744 } |
| 753 | 745 |
| 754 void test_getAnalysisOptions_default_noOverrides() { | 746 void test_getAnalysisOptions_default_noOverrides() { |
| 755 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); | 747 AnalysisOptionsImpl defaultOptions = new AnalysisOptionsImpl(); |
| 756 defaultOptions.enableLazyAssignmentOperators = true; | 748 defaultOptions.enableLazyAssignmentOperators = true; |
| 757 builderOptions.defaultOptions = defaultOptions; | 749 builderOptions.defaultOptions = defaultOptions; |
| 758 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); | 750 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); |
| 759 expected.enableLazyAssignmentOperators = true; | 751 expected.enableLazyAssignmentOperators = true; |
| 760 String path = resourceProvider.convertPath('/some/directory/path'); | 752 String path = resourceProvider.convertPath('/some/directory/path'); |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1021 class _MockLintRule implements LintRule { | 1013 class _MockLintRule implements LintRule { |
| 1022 final String _name; | 1014 final String _name; |
| 1023 | 1015 |
| 1024 _MockLintRule(this._name); | 1016 _MockLintRule(this._name); |
| 1025 | 1017 |
| 1026 @override | 1018 @override |
| 1027 String get name => _name; | 1019 String get name => _name; |
| 1028 | 1020 |
| 1029 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); | 1021 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); |
| 1030 } | 1022 } |
| OLD | NEW |