Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(419)

Unified Diff: pkg/analysis_server/test/context_manager_test.dart

Issue 1243063003: Get rid of ContextManager._contexts. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix typo. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 be5cc771e2c7b77dde204064d73ea17038fcc818..b50e13f15b1a1b1a9a37b5c7821a837338e7970f 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -96,6 +96,30 @@ class AbstractContextManagerTest {
ContextManagerImpl.ENABLE_PACKAGESPEC_SUPPORT = false;
}
+ void test_contextsInAnalysisRoot_nestedContext() {
+ String subProjPath = join(projPath, 'subproj');
+ Folder subProjFolder = resourceProvider.newFolder(subProjPath);
+ resourceProvider.newFile(join(subProjPath, 'pubspec.yaml'), 'contents');
+ String subProjFilePath = 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.length, 2);
+ expect(contexts, contains(projContextInfo.context));
+ expect(contexts, contains(subProjContextInfo.context));
+ }
+
test_ignoreFilesInPackagesFolder() {
// create a context with a pubspec.yaml file
String pubspecPath = posix.join(projPath, 'pubspec.yaml');
@@ -127,6 +151,21 @@ class AbstractContextManagerTest {
expect(manager.isInAnalysisRoot('$excludedFolder/test.dart'), isFalse);
}
+ void test_isInAnalysisRoot_inNestedContext() {
+ String subProjPath = join(projPath, 'subproj');
+ Folder subProjFolder = resourceProvider.newFolder(subProjPath);
+ resourceProvider.newFile(join(subProjPath, 'pubspec.yaml'), 'contents');
+ String subProjFilePath = join(subProjPath, 'file.dart');
+ resourceProvider.newFile(subProjFilePath, 'contents');
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ // Make sure that there really is a context for the subproject.
+ ContextInfo subProjContextInfo = manager.getContextInfoFor(subProjFolder);
+ expect(subProjContextInfo, isNotNull);
+ expect(subProjContextInfo.folder, subProjFolder);
+ // Check that isInAnalysisRoot() works.
+ expect(manager.isInAnalysisRoot(subProjFilePath), isTrue);
+ }
+
void test_isInAnalysisRoot_inRoot() {
manager.setRoots(<String>[projPath], <String>[], <String, String>{});
expect(manager.isInAnalysisRoot('$projPath/test.dart'), isTrue);
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698