| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 test.context.directory.manager; | 5 library test.context.directory.manager; |
| 6 | 6 |
| 7 import 'dart:collection'; | 7 import 'dart:collection'; |
| 8 import 'dart:io' as io; | 8 import 'dart:io' as io; |
| 9 | 9 |
| 10 import 'package:analysis_server/src/context_manager.dart'; | 10 import 'package:analysis_server/src/context_manager.dart'; |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 149 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
| 150 await pumpEventQueue(); | 150 await pumpEventQueue(); |
| 151 // Confirm that one context was created. | 151 // Confirm that one context was created. |
| 152 var contexts = | 152 var contexts = |
| 153 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); | 153 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); |
| 154 expect(contexts, isNotNull); | 154 expect(contexts, isNotNull); |
| 155 expect(contexts.length, equals(1)); | 155 expect(contexts.length, equals(1)); |
| 156 var context = contexts[0]; | 156 var context = contexts[0]; |
| 157 var source = context.sourceFactory.forUri('dart:foobar'); | 157 var source = context.sourceFactory.forUri('dart:foobar'); |
| 158 expect(source, isNotNull); | 158 expect(source, isNotNull); |
| 159 expect( | 159 expect(source.fullName, '/my/proj/sdk_ext/entry.dart'); |
| 160 source.fullName, | |
| 161 '/my/proj/sdk_ext/entry.dart' | |
| 162 .replaceAll('/', io.Platform.pathSeparator)); | |
| 163 // We can't find dart:core because we didn't list it in our | 160 // We can't find dart:core because we didn't list it in our |
| 164 // embedded_libs map. | 161 // embedded_libs map. |
| 165 expect(context.sourceFactory.forUri('dart:core'), isNull); | 162 expect(context.sourceFactory.forUri('dart:core'), isNull); |
| 166 // We can find dart:typed_data because we listed it in our | 163 // We can find dart:typed_data because we listed it in our |
| 167 // embedded_libs map. | 164 // embedded_libs map. |
| 168 expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull); | 165 expect(context.sourceFactory.forUri('dart:typed_data'), isNotNull); |
| 169 } | 166 } |
| 170 | 167 |
| 171 test_ignoreFilesInPackagesFolder() { | 168 test_ignoreFilesInPackagesFolder() { |
| 172 // create a context with a pubspec.yaml file | 169 // create a context with a pubspec.yaml file |
| (...skipping 1984 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2157 lintNames, | 2154 lintNames, |
| 2158 unorderedEquals([ | 2155 unorderedEquals([ |
| 2159 'avoid_as' /* embedder */, | 2156 'avoid_as' /* embedder */, |
| 2160 'always_specify_types' /* config*/, | 2157 'always_specify_types' /* config*/, |
| 2161 'camel_case_types' /* options */ | 2158 'camel_case_types' /* options */ |
| 2162 ])); | 2159 ])); |
| 2163 | 2160 |
| 2164 // Sanity check embedder libs. | 2161 // Sanity check embedder libs. |
| 2165 var source = context.sourceFactory.forUri('dart:foobar'); | 2162 var source = context.sourceFactory.forUri('dart:foobar'); |
| 2166 expect(source, isNotNull); | 2163 expect(source, isNotNull); |
| 2167 expect( | 2164 expect(source.fullName, '/my/proj/sdk_ext/entry.dart'); |
| 2168 source.fullName, | |
| 2169 '/my/proj/sdk_ext/entry.dart' | |
| 2170 .replaceAll('/', io.Platform.pathSeparator)); | |
| 2171 } | 2165 } |
| 2172 | 2166 |
| 2173 test_embedder_options() async { | 2167 test_embedder_options() async { |
| 2174 // Create files. | 2168 // Create files. |
| 2175 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); | 2169 String libPath = newFolder([projPath, ContextManagerTest.LIB_NAME]); |
| 2176 String sdkExtPath = newFolder([projPath, 'sdk_ext']); | 2170 String sdkExtPath = newFolder([projPath, 'sdk_ext']); |
| 2177 newFile([projPath, 'test', 'test.dart']); | 2171 newFile([projPath, 'test', 'test.dart']); |
| 2178 newFile([sdkExtPath, 'entry.dart']); | 2172 newFile([sdkExtPath, 'entry.dart']); |
| 2179 // Setup _embedder.yaml. | 2173 // Setup _embedder.yaml. |
| 2180 newFile( | 2174 newFile( |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2251 var lintNames = lints.map((lint) => lint.name); | 2245 var lintNames = lints.map((lint) => lint.name); |
| 2252 | 2246 |
| 2253 expect( | 2247 expect( |
| 2254 lintNames, | 2248 lintNames, |
| 2255 unorderedEquals( | 2249 unorderedEquals( |
| 2256 ['avoid_as' /* embedder */, 'camel_case_types' /* options */])); | 2250 ['avoid_as' /* embedder */, 'camel_case_types' /* options */])); |
| 2257 | 2251 |
| 2258 // Sanity check embedder libs. | 2252 // Sanity check embedder libs. |
| 2259 var source = context.sourceFactory.forUri('dart:foobar'); | 2253 var source = context.sourceFactory.forUri('dart:foobar'); |
| 2260 expect(source, isNotNull); | 2254 expect(source, isNotNull); |
| 2261 expect( | 2255 expect(source.fullName, '/my/proj/sdk_ext/entry.dart'); |
| 2262 source.fullName, | |
| 2263 '/my/proj/sdk_ext/entry.dart' | |
| 2264 .replaceAll('/', io.Platform.pathSeparator)); | |
| 2265 } | 2256 } |
| 2266 | 2257 |
| 2267 test_error_filter_analysis_option() async { | 2258 test_error_filter_analysis_option() async { |
| 2268 // Create files. | 2259 // Create files. |
| 2269 newFile( | 2260 newFile( |
| 2270 [projPath, optionsFileName], | 2261 [projPath, optionsFileName], |
| 2271 r''' | 2262 r''' |
| 2272 analyzer: | 2263 analyzer: |
| 2273 errors: | 2264 errors: |
| 2274 unused_local_variable: ignore | 2265 unused_local_variable: ignore |
| (...skipping 491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2766 class TestUriResolver extends UriResolver { | 2757 class TestUriResolver extends UriResolver { |
| 2767 Map<Uri, Source> uriMap; | 2758 Map<Uri, Source> uriMap; |
| 2768 | 2759 |
| 2769 TestUriResolver(this.uriMap); | 2760 TestUriResolver(this.uriMap); |
| 2770 | 2761 |
| 2771 @override | 2762 @override |
| 2772 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 2763 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 2773 return uriMap[uri]; | 2764 return uriMap[uri]; |
| 2774 } | 2765 } |
| 2775 } | 2766 } |
| OLD | NEW |