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/context/builder.dart'; | 10 import 'package:analyzer/src/context/builder.dart'; |
10 import 'package:analyzer/src/context/source.dart'; | 11 import 'package:analyzer/src/context/source.dart'; |
11 import 'package:analyzer/src/generated/bazel.dart'; | 12 import 'package:analyzer/src/generated/bazel.dart'; |
12 import 'package:analyzer/src/generated/engine.dart'; | 13 import 'package:analyzer/src/generated/engine.dart'; |
13 import 'package:analyzer/src/generated/sdk.dart'; | 14 import 'package:analyzer/src/generated/sdk.dart'; |
14 import 'package:analyzer/src/generated/source.dart'; | 15 import 'package:analyzer/src/generated/source.dart'; |
| 16 import 'package:args/args.dart'; |
15 import 'package:package_config/packages.dart'; | 17 import 'package:package_config/packages.dart'; |
16 import 'package:package_config/src/packages_impl.dart'; | 18 import 'package:package_config/src/packages_impl.dart'; |
17 import 'package:path/path.dart' as path; | 19 import 'package:path/path.dart' as path; |
18 import 'package:test/test.dart'; | 20 import 'package:test/test.dart'; |
19 import 'package:test_reflective_loader/test_reflective_loader.dart'; | 21 import 'package:test_reflective_loader/test_reflective_loader.dart'; |
20 | 22 |
21 import '../../embedder_tests.dart'; | 23 import '../../embedder_tests.dart'; |
22 import '../../generated/test_support.dart'; | 24 import '../../generated/test_support.dart'; |
23 import 'mock_sdk.dart'; | 25 import 'mock_sdk.dart'; |
24 | 26 |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 contentCache = new ContentCache(); | 105 contentCache = new ContentCache(); |
104 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache, | 106 builder = new ContextBuilder(resourceProvider, sdkManager, contentCache, |
105 options: builderOptions); | 107 options: builderOptions); |
106 } | 108 } |
107 | 109 |
108 @failingTest | 110 @failingTest |
109 void test_buildContext() { | 111 void test_buildContext() { |
110 fail('Incomplete test'); | 112 fail('Incomplete test'); |
111 } | 113 } |
112 | 114 |
| 115 void test_cmdline_options_override_options_file() { |
| 116 ArgParser argParser = new ArgParser(); |
| 117 defineAnalysisArguments(argParser); |
| 118 ArgResults argResults = argParser.parse(['--$enableStrictCallChecksFlag']); |
| 119 var builder = new ContextBuilder(resourceProvider, sdkManager, contentCache, |
| 120 options: createContextBuilderOptions(argResults)); |
| 121 |
| 122 AnalysisOptionsImpl expected = new AnalysisOptionsImpl(); |
| 123 expected.enableSuperMixins = true; |
| 124 expected.enableStrictCallChecks = true; |
| 125 |
| 126 String path = resourceProvider.convertPath('/some/directory/path'); |
| 127 String filePath = |
| 128 pathContext.join(path, AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE); |
| 129 resourceProvider.newFile( |
| 130 filePath, |
| 131 ''' |
| 132 analyzer: |
| 133 language: |
| 134 enableSuperMixins : true |
| 135 enableStrictCallChecks : false |
| 136 '''); |
| 137 |
| 138 AnalysisOptions options = builder.getAnalysisOptions(path); |
| 139 _expectEqualOptions(options, expected); |
| 140 } |
| 141 |
113 void test_convertPackagesToMap_noPackages() { | 142 void test_convertPackagesToMap_noPackages() { |
114 expect(builder.convertPackagesToMap(Packages.noPackages), isEmpty); | 143 expect(builder.convertPackagesToMap(Packages.noPackages), isEmpty); |
115 } | 144 } |
116 | 145 |
117 void test_convertPackagesToMap_null() { | 146 void test_convertPackagesToMap_null() { |
118 expect(builder.convertPackagesToMap(null), isEmpty); | 147 expect(builder.convertPackagesToMap(null), isEmpty); |
119 } | 148 } |
120 | 149 |
121 void test_convertPackagesToMap_packages() { | 150 void test_convertPackagesToMap_packages() { |
122 String fooName = 'foo'; | 151 String fooName = 'foo'; |
(...skipping 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
722 expect(locator.embedderYamls, hasLength(0)); | 751 expect(locator.embedderYamls, hasLength(0)); |
723 } | 752 } |
724 | 753 |
725 void test_valid() { | 754 void test_valid() { |
726 EmbedderYamlLocator locator = new EmbedderYamlLocator({ | 755 EmbedderYamlLocator locator = new EmbedderYamlLocator({ |
727 'fox': <Folder>[pathTranslator.getResource(foxLib)] | 756 'fox': <Folder>[pathTranslator.getResource(foxLib)] |
728 }); | 757 }); |
729 expect(locator.embedderYamls, hasLength(1)); | 758 expect(locator.embedderYamls, hasLength(1)); |
730 } | 759 } |
731 } | 760 } |
OLD | NEW |