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