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

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

Issue 341123007: Rerun "pub list" when pubspec.lock changes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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/domain_analysis_test.dart
diff --git a/pkg/analysis_server/test/domain_analysis_test.dart b/pkg/analysis_server/test/domain_analysis_test.dart
index caae29441e85cffa5628cc508473494ca55f3d0a..93c99207289d005b6027cd474a6affbdf02d46b8 100644
--- a/pkg/analysis_server/test/domain_analysis_test.dart
+++ b/pkg/analysis_server/test/domain_analysis_test.dart
@@ -12,6 +12,7 @@ import 'package:analysis_server/src/domain_analysis.dart';
import 'package:analysis_server/src/protocol.dart';
import 'package:analysis_server/src/resource.dart';
import 'package:analyzer/src/generated/engine.dart';
+import 'package:path/path.dart';
import 'package:unittest/unittest.dart';
import 'mocks.dart';
@@ -593,4 +594,36 @@ main(A a) {
expect(filesErrors[pkgFile], isEmpty);
});
}
+
+ test_packageMapDependencies() {
+ // Prepare a source file that has errors because it refers to an unknown
+ // package.
+ String pkgFile = '/packages/pkgA/libA.dart';
+ resourceProvider.newFile(pkgFile, '''
+library lib_a;
+class A {}
+''');
+ addTestFile('''
+import 'package:pkgA/libA.dart';
+f(A a) {
+}
+''');
+ String pkgDependency = posix.join(projectPath, 'package_dep');
+ resourceProvider.newFile(pkgDependency, 'contents');
+ packageMapProvider.dependencies.add(pkgDependency);
+ // Create project and wait for analysis
+ createProject();
+ return waitForTasksFinished().then((_) {
+ expect(filesErrors[testFile], isNot(isEmpty));
+ // Add the package to the package map and tickle the package dependency.
+ packageMapProvider.packageMap = {
+ 'pkgA': [resourceProvider.getResource('/packages/pkgA')] };
+ resourceProvider.modifyFile(pkgDependency, 'new contents');
+ // Let the server time to notice the file has changed, then let
+ // analysis omplete. There should now be no error.
+ return pumpEventQueue().then((_) => waitForTasksFinished()).then((_) {
+ expect(filesErrors[testFile], isEmpty);
+ });
+ });
+ }
}

Powered by Google App Engine
This is Rietveld 408576698