| 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 | 8 |
| 9 import 'package:analysis_server/src/context_manager.dart'; | 9 import 'package:analysis_server/src/context_manager.dart'; |
| 10 import 'package:analyzer/file_system/file_system.dart'; | 10 import 'package:analyzer/file_system/file_system.dart'; |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 309 | 309 |
| 310 // Setup .analysis_options | 310 // Setup .analysis_options |
| 311 newFile( | 311 newFile( |
| 312 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], | 312 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], |
| 313 r''' | 313 r''' |
| 314 analyzer: | 314 analyzer: |
| 315 exclude: | 315 exclude: |
| 316 - 'test/**' | 316 - 'test/**' |
| 317 language: | 317 language: |
| 318 enableGenericMethods: true | 318 enableGenericMethods: true |
| 319 enableAsync: false |
| 319 errors: | 320 errors: |
| 320 unused_local_variable: false | 321 unused_local_variable: false |
| 321 linter: | 322 linter: |
| 322 rules: | 323 rules: |
| 323 - camel_case_types | 324 - camel_case_types |
| 324 '''); | 325 '''); |
| 325 | 326 |
| 326 // Setup context. | 327 // Setup context. |
| 327 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 328 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
| 328 await pumpEventQueue(); | 329 await pumpEventQueue(); |
| 329 | 330 |
| 330 // Confirm that one context was created. | 331 // Confirm that one context was created. |
| 331 var contexts = | 332 var contexts = |
| 332 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); | 333 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); |
| 333 expect(contexts, isNotNull); | 334 expect(contexts, isNotNull); |
| 334 expect(contexts, hasLength(1)); | 335 expect(contexts, hasLength(1)); |
| 335 var context = contexts[0]; | 336 var context = contexts[0]; |
| 336 | 337 |
| 337 // Verify options. | 338 // Verify options. |
| 338 // * from `_embedder.yaml`: | 339 // * from `_embedder.yaml`: |
| 339 expect(context.analysisOptions.strongMode, isTrue); | 340 expect(context.analysisOptions.strongMode, isTrue); |
| 340 expect(context.analysisOptions.enableSuperMixins, isTrue); | 341 expect(context.analysisOptions.enableSuperMixins, isTrue); |
| 342 expect(context.analysisOptions.enableAsync, isFalse); |
| 341 // * from `.analysis_options`: | 343 // * from `.analysis_options`: |
| 342 expect(context.analysisOptions.enableGenericMethods, isTrue); | 344 expect(context.analysisOptions.enableGenericMethods, isTrue); |
| 343 // * verify tests are excluded | 345 // * verify tests are excluded |
| 344 expect(callbacks.currentContextFilePaths[projPath].keys, | 346 expect(callbacks.currentContextFilePaths[projPath].keys, |
| 345 ['/my/proj/sdk_ext/entry.dart']); | 347 ['/my/proj/sdk_ext/entry.dart']); |
| 346 | 348 |
| 347 // Verify filter setup. | 349 // Verify filter setup. |
| 348 expect(errorProcessors, hasLength(2)); | 350 expect(errorProcessors, hasLength(2)); |
| 349 | 351 |
| 350 // * (embedder.) | 352 // * (embedder.) |
| (...skipping 2065 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2416 class TestUriResolver extends UriResolver { | 2418 class TestUriResolver extends UriResolver { |
| 2417 Map<Uri, Source> uriMap; | 2419 Map<Uri, Source> uriMap; |
| 2418 | 2420 |
| 2419 TestUriResolver(this.uriMap); | 2421 TestUriResolver(this.uriMap); |
| 2420 | 2422 |
| 2421 @override | 2423 @override |
| 2422 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 2424 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 2423 return uriMap[uri]; | 2425 return uriMap[uri]; |
| 2424 } | 2426 } |
| 2425 } | 2427 } |
| OLD | NEW |