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