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

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

Issue 1180843011: recompute package map when input file changes (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: merge Created 5 years, 6 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
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 ba4210d71306fa8f5c2628eeb0637631a8702d47..2908cded61dd572875f112572270072a820fa9c5 100644
--- a/pkg/analysis_server/test/context_manager_test.dart
+++ b/pkg/analysis_server/test/context_manager_test.dart
@@ -858,6 +858,34 @@ class ContextManagerTest {
});
}
+ test_watch_modifyPackageMapDependency_outsideProject() {
+ // create a dependency file
+ String dependencyPath = '/my/other/dep';
+ resourceProvider.newFile(dependencyPath, 'contents');
+ packageMapProvider.dependencies.add(dependencyPath);
+ // create a Dart file
+ String dartFilePath = posix.join(projPath, 'main.dart');
+ resourceProvider.newFile(dartFilePath, 'contents');
+ // the created context has the expected empty package map
+ manager.setRoots(<String>[projPath], <String>[], <String, String>{});
+ _checkPackageMap(projPath, isEmpty);
+ // configure package map
+ String packagePath = '/package/foo';
+ resourceProvider.newFolder(packagePath);
+ packageMapProvider.packageMap = {'foo': projPath};
+ // Changing a .dart file in the project shouldn't cause a new
+ // package map to be picked up.
+ resourceProvider.modifyFile(dartFilePath, 'new contents');
+ return pumpEventQueue().then((_) {
+ _checkPackageMap(projPath, isEmpty);
+ // However, changing the package map dependency should.
+ resourceProvider.modifyFile(dependencyPath, 'new contents');
+ return pumpEventQueue().then((_) {
+ _checkPackageMap(projPath, equals(packageMapProvider.packageMap));
+ });
+ });
+ }
+
test_watch_modifyPackageMapDependency_redundantly() async {
// Create two dependency files
String dependencyPath1 = posix.join(projPath, 'dep1');
« no previous file with comments | « pkg/analysis_server/lib/src/context_manager.dart ('k') | pkg/analyzer/lib/file_system/memory_file_system.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698