Index: pkg/analysis_server/test/context_manager_test.dart |
diff --git a/pkg/analysis_server/test/context_manager_test.dart b/pkg/analysis_server/test/context_manager_test.dart |
index dd3961c80d15393840a0e2e3df3fc8afae24f337..c24a0f5caa9eb62e1aca479daa78d80cac15c37c 100644 |
--- a/pkg/analysis_server/test/context_manager_test.dart |
+++ b/pkg/analysis_server/test/context_manager_test.dart |
@@ -17,6 +17,7 @@ import 'package:analyzer/src/generated/source.dart'; |
import 'package:analyzer/src/generated/source_io.dart'; |
import 'package:package_config/packages.dart'; |
import 'package:path/path.dart'; |
+import 'package:plugin/manager.dart'; |
import 'package:test_reflective_loader/test_reflective_loader.dart'; |
import 'package:unittest/unittest.dart'; |
@@ -79,11 +80,17 @@ class AbstractContextManagerTest { |
return folderPath; |
} |
+ void processRequiredPlugins() { |
+ ExtensionManager manager = new ExtensionManager(); |
+ manager.processPlugins(AnalysisEngine.instance.requiredPlugins); |
+ } |
+ |
UriResolver providePackageResolver(Folder folder) { |
return packageResolver; |
} |
void setUp() { |
+ processRequiredPlugins(); |
resourceProvider = new MemoryResourceProvider(); |
packageMapProvider = new MockPackageMapProvider(); |
manager = new ContextManagerImpl(resourceProvider, providePackageResolver, |
@@ -93,6 +100,51 @@ class AbstractContextManagerTest { |
resourceProvider.newFolder(projPath); |
} |
+ test_analysis_options_parse_failure() async { |
+ // Create files. |
+ String libPath = newFolder([projPath, LIB_NAME]); |
+ newFile([libPath, 'main.dart']); |
+ String sdkExtPath = newFolder([projPath, 'sdk_ext']); |
+ newFile([sdkExtPath, 'entry.dart']); |
+ String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); |
+ newFile([sdkExtSrcPath, 'part.dart']); |
+ // Setup analysis options file with ignore list. |
+ newFile( |
+ [projPath, '.analysis_options'], |
+ r''' |
+; |
+'''); |
+ // Setup context. |
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
+ |
+ // No error means success. |
+ } |
+ |
+ void test_contextsInAnalysisRoot_nestedContext() { |
+ String subProjPath = posix.join(projPath, 'subproj'); |
+ Folder subProjFolder = resourceProvider.newFolder(subProjPath); |
+ resourceProvider.newFile( |
+ posix.join(subProjPath, 'pubspec.yaml'), 'contents'); |
+ String subProjFilePath = posix.join(subProjPath, 'file.dart'); |
+ resourceProvider.newFile(subProjFilePath, 'contents'); |
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
+ // Make sure that there really are contexts for both the main project and |
+ // the subproject. |
+ Folder projFolder = resourceProvider.getFolder(projPath); |
+ ContextInfo projContextInfo = manager.getContextInfoFor(projFolder); |
+ expect(projContextInfo, isNotNull); |
+ expect(projContextInfo.folder, projFolder); |
+ ContextInfo subProjContextInfo = manager.getContextInfoFor(subProjFolder); |
+ expect(subProjContextInfo, isNotNull); |
+ expect(subProjContextInfo.folder, subProjFolder); |
+ expect(projContextInfo.context != subProjContextInfo.context, isTrue); |
+ // Check that contextsInAnalysisRoot() works. |
+ List<AnalysisContext> contexts = manager.contextsInAnalysisRoot(projFolder); |
+ expect(contexts, hasLength(2)); |
+ expect(contexts, contains(projContextInfo.context)); |
+ expect(contexts, contains(subProjContextInfo.context)); |
+ } |
+ |
test_embedder_options() async { |
// Create files. |
String libPath = newFolder([projPath, LIB_NAME]); |
@@ -167,51 +219,6 @@ analyzer: |
expect(source.fullName, '/my/proj/sdk_ext/entry.dart'); |
} |
- test_analysis_options_parse_failure() async { |
- // Create files. |
- String libPath = newFolder([projPath, LIB_NAME]); |
- newFile([libPath, 'main.dart']); |
- String sdkExtPath = newFolder([projPath, 'sdk_ext']); |
- newFile([sdkExtPath, 'entry.dart']); |
- String sdkExtSrcPath = newFolder([projPath, 'sdk_ext', 'src']); |
- newFile([sdkExtSrcPath, 'part.dart']); |
- // Setup analysis options file with ignore list. |
- newFile( |
- [projPath, '.analysis_options'], |
- r''' |
-; |
-'''); |
- // Setup context. |
- manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
- |
- // No error means success. |
- } |
- |
- void test_contextsInAnalysisRoot_nestedContext() { |
- String subProjPath = posix.join(projPath, 'subproj'); |
- Folder subProjFolder = resourceProvider.newFolder(subProjPath); |
- resourceProvider.newFile( |
- posix.join(subProjPath, 'pubspec.yaml'), 'contents'); |
- String subProjFilePath = posix.join(subProjPath, 'file.dart'); |
- resourceProvider.newFile(subProjFilePath, 'contents'); |
- manager.setRoots(<String>[projPath], <String>[], <String, String>{}); |
- // Make sure that there really are contexts for both the main project and |
- // the subproject. |
- Folder projFolder = resourceProvider.getFolder(projPath); |
- ContextInfo projContextInfo = manager.getContextInfoFor(projFolder); |
- expect(projContextInfo, isNotNull); |
- expect(projContextInfo.folder, projFolder); |
- ContextInfo subProjContextInfo = manager.getContextInfoFor(subProjFolder); |
- expect(subProjContextInfo, isNotNull); |
- expect(subProjContextInfo.folder, subProjFolder); |
- expect(projContextInfo.context != subProjContextInfo.context, isTrue); |
- // Check that contextsInAnalysisRoot() works. |
- List<AnalysisContext> contexts = manager.contextsInAnalysisRoot(projFolder); |
- expect(contexts, hasLength(2)); |
- expect(contexts, contains(projContextInfo.context)); |
- expect(contexts, contains(subProjContextInfo.context)); |
- } |
- |
test_embedder_packagespec() async { |
// Create files. |
String libPath = newFolder([projPath, LIB_NAME]); |