| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 analyzer.test.src.context.context_builder_test; | 5 library analyzer.test.src.context.context_builder_test; |
| 6 | 6 |
| 7 import 'dart:io' as io; | 7 import 'dart:io' as io; |
| 8 | 8 |
| 9 import 'package:analyzer/file_system/file_system.dart'; | 9 import 'package:analyzer/file_system/file_system.dart'; |
| 10 import 'package:analyzer/file_system/memory_file_system.dart'; | 10 import 'package:analyzer/file_system/memory_file_system.dart'; |
| 11 import 'package:analyzer/file_system/physical_file_system.dart'; | 11 import 'package:analyzer/file_system/physical_file_system.dart'; |
| 12 import 'package:analyzer/source/package_map_resolver.dart'; | 12 import 'package:analyzer/source/package_map_resolver.dart'; |
| 13 import 'package:analyzer/src/context/builder.dart'; | 13 import 'package:analyzer/src/context/builder.dart'; |
| 14 import 'package:analyzer/src/context/source.dart'; | 14 import 'package:analyzer/src/context/source.dart'; |
| 15 import 'package:analyzer/src/generated/engine.dart'; | 15 import 'package:analyzer/src/generated/engine.dart'; |
| 16 import 'package:analyzer/src/generated/sdk.dart'; | 16 import 'package:analyzer/src/generated/sdk.dart'; |
| 17 import 'package:analyzer/src/generated/source.dart'; | 17 import 'package:analyzer/src/generated/source.dart'; |
| 18 import 'package:package_config/packages.dart'; | 18 import 'package:package_config/packages.dart'; |
| 19 import 'package:package_config/src/packages_impl.dart'; | 19 import 'package:package_config/src/packages_impl.dart'; |
| 20 import 'package:path/path.dart' as path; | 20 import 'package:path/path.dart' as path; |
| 21 import 'package:unittest/unittest.dart'; | 21 import 'package:unittest/unittest.dart'; |
| 22 | 22 |
| 23 import '../../generated/test_support.dart'; | 23 import '../../generated/test_support.dart'; |
| 24 import '../../reflective_tests.dart'; | 24 import '../../reflective_tests.dart'; |
| 25 import '../../source/embedder_test.dart'; |
| 25 import '../../utils.dart'; | 26 import '../../utils.dart'; |
| 26 import 'mock_sdk.dart'; | 27 import 'mock_sdk.dart'; |
| 27 | 28 |
| 28 main() { | 29 main() { |
| 29 initializeTestEnvironment(); | 30 initializeTestEnvironment(); |
| 30 runReflectiveTests(ContextBuilderTest_WithDisk); | 31 runReflectiveTests(ContextBuilderTest_WithDisk); |
| 31 runReflectiveTests(ContextBuilderTest_WithoutDisk); | 32 runReflectiveTests(ContextBuilderTest_WithoutDisk); |
| 33 runReflectiveTests(EmbedderYamlLocatorTest); |
| 32 } | 34 } |
| 33 | 35 |
| 34 @reflectiveTest | 36 @reflectiveTest |
| 35 class ContextBuilderTest_WithDisk extends EngineTestCase { | 37 class ContextBuilderTest_WithDisk extends EngineTestCase { |
| 36 /** | 38 /** |
| 37 * The resource provider to be used by tests. | 39 * The resource provider to be used by tests. |
| 38 */ | 40 */ |
| 39 PhysicalResourceProvider resourceProvider; | 41 PhysicalResourceProvider resourceProvider; |
| 40 | 42 |
| 41 /** | 43 /** |
| (...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 688 expect(actual.lint, expected.lint); | 690 expect(actual.lint, expected.lint); |
| 689 expect(actual.preserveComments, expected.preserveComments); | 691 expect(actual.preserveComments, expected.preserveComments); |
| 690 expect(actual.strongMode, expected.strongMode); | 692 expect(actual.strongMode, expected.strongMode); |
| 691 expect(actual.strongModeHints, expected.strongModeHints); | 693 expect(actual.strongModeHints, expected.strongModeHints); |
| 692 expect(actual.implicitCasts, expected.implicitCasts); | 694 expect(actual.implicitCasts, expected.implicitCasts); |
| 693 expect(actual.implicitDynamic, expected.implicitDynamic); | 695 expect(actual.implicitDynamic, expected.implicitDynamic); |
| 694 expect(actual.trackCacheDependencies, expected.trackCacheDependencies); | 696 expect(actual.trackCacheDependencies, expected.trackCacheDependencies); |
| 695 expect(actual.finerGrainedInvalidation, expected.finerGrainedInvalidation); | 697 expect(actual.finerGrainedInvalidation, expected.finerGrainedInvalidation); |
| 696 } | 698 } |
| 697 } | 699 } |
| 700 |
| 701 @reflectiveTest |
| 702 class EmbedderYamlLocatorTest extends EmbedderRelatedTest { |
| 703 void test_empty() { |
| 704 EmbedderYamlLocator locator = new EmbedderYamlLocator({ |
| 705 'fox': [pathTranslator.getResource('/empty')] |
| 706 }); |
| 707 expect(locator.embedderYamls, hasLength(0)); |
| 708 } |
| 709 |
| 710 void test_invalid() { |
| 711 EmbedderYamlLocator locator = new EmbedderYamlLocator(null); |
| 712 locator.addEmbedderYaml(null, r'''{{{,{{}}},}}'''); |
| 713 expect(locator.embedderYamls, hasLength(0)); |
| 714 } |
| 715 |
| 716 void test_valid() { |
| 717 EmbedderYamlLocator locator = new EmbedderYamlLocator({ |
| 718 'fox': [pathTranslator.getResource('/tmp')] |
| 719 }); |
| 720 expect(locator.embedderYamls, hasLength(1)); |
| 721 } |
| 722 } |
| OLD | NEW |