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