| 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);
|
| + });
|
| + });
|
| + }
|
| }
|
|
|