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

Unified Diff: pkg/analysis_server/test/analysis/update_content_test.dart

Issue 1214853028: One more fix for making removing overlays incremental changes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/analysis/update_content_test.dart
diff --git a/pkg/analysis_server/test/analysis/update_content_test.dart b/pkg/analysis_server/test/analysis/update_content_test.dart
index b8c313d34fa07ed4a138540df0ee0ac51b3136ed..135ce6ab31509efd998ef0e7008499325c8d0e3d 100644
--- a/pkg/analysis_server/test/analysis/update_content_test.dart
+++ b/pkg/analysis_server/test/analysis/update_content_test.dart
@@ -4,6 +4,7 @@
library test.analysis.updateContent;
+import 'package:analysis_server/src/analysis_server.dart';
import 'package:analysis_server/src/constants.dart';
import 'package:analysis_server/src/protocol.dart';
import 'package:analysis_server/src/services/index/index.dart';
@@ -177,6 +178,24 @@ f() {}
expect(_getUserSources(context2), isEmpty);
}
+ test_removeOverlay_incrementalChange() async {
+ createProject();
+ addTestFile('main() { print(1); }');
+ await server.onAnalysisComplete;
+ CompilationUnit unit = _getTestUnit();
+ // add an overlay
+ server.updateContent(
+ '1', {testFile: new AddContentOverlay('main() { print(2); }')});
+ // it was an incremental change
+ await server.onAnalysisComplete;
+ expect(_getTestUnit(), same(unit));
+ // remove overlay
+ server.updateContent('2', {testFile: new RemoveContentOverlay()});
+ // it was an incremental change
+ await server.onAnalysisComplete;
+ expect(_getTestUnit(), same(unit));
+ }
+
test_sendNoticesAfterNopChange() async {
createProject();
addTestFile('');
@@ -214,6 +233,13 @@ f() {}
expect(filesErrors, isNotEmpty);
}
+ CompilationUnit _getTestUnit() {
+ ContextSourcePair pair = server.getContextSourcePair(testFile);
+ AnalysisContext context = pair.context;
+ Source source = pair.source;
+ return context.getResolvedCompilationUnit2(source, source);
+ }
+
List<Source> _getUserSources(AnalysisContext context) {
List<Source> sources = <Source>[];
context.sources.forEach((source) {
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/context/context.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698