| 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/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 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 ArgResults argResults = argParser.parse(['--$enableStrictCallChecksFlag']); | 118 ArgResults argResults = argParser.parse(['--$enableStrictCallChecksFlag']); |
| 119 var builder = new ContextBuilder(resourceProvider, sdkManager, contentCache, | 119 var builder = new ContextBuilder(resourceProvider, sdkManager, contentCache, |
| 120 options: createContextBuilderOptions(argResults)); | 120 options: createContextBuilderOptions(argResults)); |
| 121 | 121 |
| 122 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); | 122 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); |
| 123 expected.enableSuperMixins = true; | 123 expected.enableSuperMixins = true; |
| 124 expected.enableStrictCallChecks = true; | 124 expected.enableStrictCallChecks = true; |
| 125 | 125 |
| 126 String path = resourceProvider.convertPath('/some/directory/path'); | 126 String path = resourceProvider.convertPath('/some/directory/path'); |
| 127 String filePath = | 127 String filePath = |
| 128 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); | 128 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); |
| 129 resourceProvider.newFile( | 129 resourceProvider.newFile( |
| 130 filePath, | 130 filePath, |
| 131 ''' | 131 ''' |
| 132 analyzer: | 132 analyzer: |
| 133 language: | 133 language: |
| 134 enableSuperMixins : true | 134 enableSuperMixins : true |
| 135 enableStrictCallChecks : false | 135 enableStrictCallChecks : false |
| 136 '''); | 136 '''); |
| 137 | 137 |
| 138 AnalysisOptions options = builder.getAnalysisOptions(path); | 138 AnalysisOptions options = builder.getAnalysisOptions(path); |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 expect(map['bar'], barUri); | 297 expect(map['bar'], barUri); |
| 298 } | 298 } |
| 299 | 299 |
| 300 void test_createPackageMap_none() { | 300 void test_createPackageMap_none() { |
| 301 String rootPath = resourceProvider.convertPath('/root'); | 301 String rootPath = resourceProvider.convertPath('/root'); |
| 302 resourceProvider.newFolder(rootPath); | 302 resourceProvider.newFolder(rootPath); |
| 303 Packages packages = builder.createPackageMap(rootPath); | 303 Packages packages = builder.createPackageMap(rootPath); |
| 304 expect(packages, same(Packages.noPackages)); | 304 expect(packages, same(Packages.noPackages)); |
| 305 } | 305 } |
| 306 | 306 |
| 307 void test_createPackageMap_rootDoesNotExist() { |
| 308 String rootPath = resourceProvider.convertPath('/root'); |
| 309 Packages packages = builder.createPackageMap(rootPath); |
| 310 expect(packages, same(Packages.noPackages)); |
| 311 } |
| 312 |
| 307 void test_createSourceFactory_bazelWorkspace_fileProvider() { | 313 void test_createSourceFactory_bazelWorkspace_fileProvider() { |
| 308 String _p(String path) => resourceProvider.convertPath(path); | 314 String _p(String path) => resourceProvider.convertPath(path); |
| 309 | 315 |
| 310 String projectPath = _p('/workspace/my/module'); | 316 String projectPath = _p('/workspace/my/module'); |
| 311 resourceProvider.newFile(_p('/workspace/WORKSPACE'), ''); | 317 resourceProvider.newFile(_p('/workspace/WORKSPACE'), ''); |
| 312 resourceProvider.newFolder(_p('/workspace/bazel-bin')); | 318 resourceProvider.newFolder(_p('/workspace/bazel-bin')); |
| 313 resourceProvider.newFolder(_p('/workspace/bazel-genfiles')); | 319 resourceProvider.newFolder(_p('/workspace/bazel-genfiles')); |
| 314 resourceProvider.newFolder(projectPath); | 320 resourceProvider.newFolder(projectPath); |
| 315 | 321 |
| 316 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); | 322 AnalysisOptionsImpl options = new AnalysisOptionsImpl(); |
| (...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 expect(locator.embedderYamls, hasLength(0)); | 757 expect(locator.embedderYamls, hasLength(0)); |
| 752 } | 758 } |
| 753 | 759 |
| 754 void test_valid() { | 760 void test_valid() { |
| 755 EmbedderYamlLocator locator = new EmbedderYamlLocator({ | 761 EmbedderYamlLocator locator = new EmbedderYamlLocator({ |
| 756 'fox': <Folder>[pathTranslator.getResource(foxLib)] | 762 'fox': <Folder>[pathTranslator.getResource(foxLib)] |
| 757 }); | 763 }); |
| 758 expect(locator.embedderYamls, hasLength(1)); | 764 expect(locator.embedderYamls, hasLength(1)); |
| 759 } | 765 } |
| 760 } | 766 } |
| OLD | NEW |