| Index: pkg/analysis_server/test/analysis/reanalyze_test.dart
|
| diff --git a/pkg/analysis_server/test/analysis/reanalyze_test.dart b/pkg/analysis_server/test/analysis/reanalyze_test.dart
|
| index cd3cd0b74d3410c0733355f0506c124705daa0f6..c2c60af0028f0a47106e15ab4efeb2deb4d62c36 100644
|
| --- a/pkg/analysis_server/test/analysis/reanalyze_test.dart
|
| +++ b/pkg/analysis_server/test/analysis/reanalyze_test.dart
|
| @@ -21,6 +21,16 @@ main() {
|
|
|
| @reflectiveTest
|
| class ReanalyzeTest extends AbstractAnalysisTest {
|
| + Map<String, List<AnalysisError>> filesErrors = {};
|
| +
|
| + @override
|
| + void processNotification(Notification notification) {
|
| + if (notification.event == ANALYSIS_ERRORS) {
|
| + var decoded = new AnalysisErrorsParams.fromNotification(notification);
|
| + filesErrors[decoded.file] = decoded.errors;
|
| + }
|
| + }
|
| +
|
| test_reanalyze() {
|
| createProject();
|
| List<AnalysisContext> contexts = server.folderMap.values.toList();
|
| @@ -34,4 +44,34 @@ class ReanalyzeTest extends AbstractAnalysisTest {
|
| AnalysisContext newContext = contexts[0];
|
| expect(newContext, isNot(same(oldContext)));
|
| }
|
| +
|
| + test_reanalyze_with_overlay() {
|
| + createProject();
|
| + resourceProvider.newFolder(testFolder);
|
| + resourceProvider.newFile(testFile, 'main() {}');
|
| + return waitForTasksFinished().then((_) {
|
| + // Update the content with an overlay that contains a syntax error.
|
| + server.updateContent('1', {
|
| + testFile: new AddContentOverlay('main() {')
|
| + });
|
| + return waitForTasksFinished();
|
| + }).then((_) {
|
| + // Verify that the syntax error was detected.
|
| + List<AnalysisError> errors = filesErrors[testFile];
|
| + expect(errors, hasLength(1));
|
| + // Remove testFile from filesErrors so that we'll notice when the file is
|
| + // re-analyzed.
|
| + filesErrors.remove(testFile);
|
| + // Reanalyze.
|
| + server.reanalyze();
|
| + return waitForTasksFinished();
|
| + }).then((_) {
|
| + // The file should have been reanalyzed.
|
| + expect(filesErrors, contains(testFile));
|
| + // Verify that the syntax error is present (this indicates that the
|
| + // content introduced by the call to updateContent is still in effect).
|
| + List<AnalysisError> errors = filesErrors[testFile];
|
| + expect(errors, hasLength(1));
|
| + });
|
| + }
|
| }
|
|
|