| 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 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 392 // Setup .analysis_options | 392 // Setup .analysis_options |
| 393 newFile( | 393 newFile( |
| 394 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], | 394 [projPath, AnalysisEngine.ANALYSIS_OPTIONS_FILE], |
| 395 r''' | 395 r''' |
| 396 analyzer: | 396 analyzer: |
| 397 exclude: | 397 exclude: |
| 398 - 'test/**' | 398 - 'test/**' |
| 399 language: | 399 language: |
| 400 enableGenericMethods: true | 400 enableGenericMethods: true |
| 401 enableAsync: false | 401 enableAsync: false |
| 402 enableConditionalDirectives: true | |
| 403 errors: | 402 errors: |
| 404 unused_local_variable: false | 403 unused_local_variable: false |
| 405 linter: | 404 linter: |
| 406 rules: | 405 rules: |
| 407 - camel_case_types | 406 - camel_case_types |
| 408 '''); | 407 '''); |
| 409 | 408 |
| 410 // Setup context. | 409 // Setup context. |
| 411 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); | 410 manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
| 412 await pumpEventQueue(); | 411 await pumpEventQueue(); |
| 413 | 412 |
| 414 // Confirm that one context was created. | 413 // Confirm that one context was created. |
| 415 var contexts = | 414 var contexts = |
| 416 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); | 415 manager.contextsInAnalysisRoot(resourceProvider.newFolder(projPath)); |
| 417 expect(contexts, isNotNull); | 416 expect(contexts, isNotNull); |
| 418 expect(contexts, hasLength(1)); | 417 expect(contexts, hasLength(1)); |
| 419 var context = contexts[0]; | 418 var context = contexts[0]; |
| 420 | 419 |
| 421 // Verify options. | 420 // Verify options. |
| 422 // * from `_embedder.yaml`: | 421 // * from `_embedder.yaml`: |
| 423 expect(context.analysisOptions.strongMode, isTrue); | 422 expect(context.analysisOptions.strongMode, isTrue); |
| 424 expect(context.analysisOptions.enableSuperMixins, isTrue); | 423 expect(context.analysisOptions.enableSuperMixins, isTrue); |
| 425 expect(context.analysisOptions.enableAsync, isFalse); | 424 expect(context.analysisOptions.enableAsync, isFalse); |
| 426 // * from `.analysis_options`: | 425 // * from `.analysis_options`: |
| 427 expect(context.analysisOptions.enableGenericMethods, isTrue); | 426 expect(context.analysisOptions.enableGenericMethods, isTrue); |
| 428 expect(context.analysisOptions.enableConditionalDirectives, isTrue); | |
| 429 | 427 |
| 430 // * verify tests are excluded | 428 // * verify tests are excluded |
| 431 expect( | 429 expect( |
| 432 callbacks.currentContextFilePaths[projPath].keys, | 430 callbacks.currentContextFilePaths[projPath].keys, |
| 433 unorderedEquals( | 431 unorderedEquals( |
| 434 ['/my/proj/sdk_ext/entry.dart', '/my/proj/.analysis_options'])); | 432 ['/my/proj/sdk_ext/entry.dart', '/my/proj/.analysis_options'])); |
| 435 | 433 |
| 436 // Verify filter setup. | 434 // Verify filter setup. |
| 437 expect(errorProcessors, hasLength(2)); | 435 expect(errorProcessors, hasLength(2)); |
| 438 | 436 |
| (...skipping 2050 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2489 class TestUriResolver extends UriResolver { | 2487 class TestUriResolver extends UriResolver { |
| 2490 Map<Uri, Source> uriMap; | 2488 Map<Uri, Source> uriMap; |
| 2491 | 2489 |
| 2492 TestUriResolver(this.uriMap); | 2490 TestUriResolver(this.uriMap); |
| 2493 | 2491 |
| 2494 @override | 2492 @override |
| 2495 Source resolveAbsolute(Uri uri, [Uri actualUri]) { | 2493 Source resolveAbsolute(Uri uri, [Uri actualUri]) { |
| 2496 return uriMap[uri]; | 2494 return uriMap[uri]; |
| 2497 } | 2495 } |
| 2498 } | 2496 } |
| OLD | NEW |