| Index: pkg/analyzer/test/src/context/context_test.dart
|
| diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
|
| index af84f24c6b3a9bbd4e66eecb185f0b5780f50e23..37c5939f1001f3dfcbfcf73e429adc2a315feaf1 100644
|
| --- a/pkg/analyzer/test/src/context/context_test.dart
|
| +++ b/pkg/analyzer/test/src/context/context_test.dart
|
| @@ -6,6 +6,7 @@ library test.src.context.context_test;
|
|
|
| import 'dart:async';
|
|
|
| +import 'package:analyzer/file_system/memory_file_system.dart';
|
| import 'package:analyzer/src/cancelable_future.dart';
|
| import 'package:analyzer/src/context/cache.dart';
|
| import 'package:analyzer/src/context/context.dart';
|
| @@ -277,6 +278,40 @@ import 'libB.dart';''';
|
| });
|
| }
|
|
|
| + /**
|
| + * IDEA uses the following scenarion:
|
| + * 1. Add overlay.
|
| + * 2. Change overlay.
|
| + * 3. If the contents of the document buffer is the same as the contents
|
| + * of the file, remove overlay.
|
| + * So, we need to try to use incremental resolution for removing overlays too.
|
| + */
|
| + void test_applyChanges_remove_incremental() {
|
| + MemoryResourceProvider resourceProvider = new MemoryResourceProvider();
|
| + Source source = resourceProvider.newFile('/test.dart', r'''
|
| +main() {
|
| + print(1);
|
| +}
|
| +''').createSource();
|
| + context.analysisOptions = new AnalysisOptionsImpl()..incremental = true;
|
| + context.applyChanges(new ChangeSet()..addedSource(source));
|
| + // remember compilation unit
|
| + _analyzeAll_assertFinished();
|
| + CompilationUnit unit = context.getResolvedCompilationUnit2(source, source);
|
| + // add overlay
|
| + context.setContents(source, r'''
|
| +main() {
|
| + print(12);
|
| +}
|
| +''');
|
| + _analyzeAll_assertFinished();
|
| + expect(context.getResolvedCompilationUnit2(source, source), unit);
|
| + // remove overlay
|
| + context.setContents(source, null);
|
| + _analyzeAll_assertFinished();
|
| + expect(context.getResolvedCompilationUnit2(source, source), unit);
|
| + }
|
| +
|
| Future test_applyChanges_removeContainer() {
|
| SourcesChangedListener listener = new SourcesChangedListener();
|
| context.onSourcesChanged.listen(listener.onData);
|
|
|