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

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

Issue 465513002: Split analysis_domain_int_test.dart into several test files. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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/integration/analysis/update_content_test.dart
diff --git a/pkg/analysis_server/test/integration/analysis/update_content_test.dart b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..dcc0871009f53d8be147cd41eebb837e27dfee7d
--- /dev/null
+++ b/pkg/analysis_server/test/integration/analysis/update_content_test.dart
@@ -0,0 +1,72 @@
+// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library test.integration.analysis.update.content;
+
+import 'package:analysis_testing/reflective_tests.dart';
+import 'package:unittest/unittest.dart';
+
+import '../integration_tests.dart';
+
+@ReflectiveTestCase()
+class Test extends AbstractAnalysisServerIntegrationTest {
+ test_updateContent() {
+ String pathname = sourcePath('test.dart');
+ String goodText = r'''
+main() {
+ print("Hello, world!");
+}''';
+ String badText = goodText.replaceAll(';', '');
+ writeFile(pathname, badText);
+ standardAnalysisSetup();
+ return analysisFinished.then((_) {
+ // The contents on disk (badText) are missing a semicolon.
+ expect(currentAnalysisErrors[pathname], isNot(isEmpty));
+ }).then((_) => sendAnalysisUpdateContent({
+ pathname: {
+ 'type': 'add',
+ 'content': goodText
+ }
+ })).then((result) => analysisFinished).then((_) {
+ // There should be no errors now because the contents on disk have been
+ // overriden with goodText.
+ expect(currentAnalysisErrors[pathname], isEmpty);
+ return sendAnalysisUpdateContent({
+ pathname: {
+ 'type': 'change',
+ 'offset': goodText.indexOf(';'),
+ 'length': 1,
+ 'replacement': ''
+ }
+ });
+ }).then((result) => analysisFinished).then((_) {
+ // There should be errors now because we've removed the semicolon.
+ expect(currentAnalysisErrors[pathname], isNot(isEmpty));
+ return sendAnalysisUpdateContent({
+ pathname: {
+ 'type': 'change',
+ 'offset': goodText.indexOf(';'),
+ 'length': 0,
+ 'replacement': ';'
+ }
+ });
+ }).then((result) => analysisFinished).then((_) {
+ // There should be no errors now because we've added the semicolon back.
+ expect(currentAnalysisErrors[pathname], isEmpty);
+ return sendAnalysisUpdateContent({
+ pathname: {
+ 'type': 'remove'
+ }
+ });
+ }).then((result) => analysisFinished).then((_) {
+ // Now there should be errors again, because the contents on disk are no
+ // longer overridden.
+ expect(currentAnalysisErrors[pathname], isNot(isEmpty));
+ });
+ }
+}
+
+main() {
+ runReflectiveTests(Test);
+}

Powered by Google App Engine
This is Rietveld 408576698