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

Unified Diff: pkg/analysis_server/test/edit/format_test.dart

Issue 1092653002: Fix "edit.format" to follow protocol when there is no selection. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 8 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 | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/edit/format_test.dart
diff --git a/pkg/analysis_server/test/edit/format_test.dart b/pkg/analysis_server/test/edit/format_test.dart
index 6a8e870e099a56719e7252efc45d765546dc2b33..1bd9f709d35503b5522f35cddb4eca40e486dabd 100644
--- a/pkg/analysis_server/test/edit/format_test.dart
+++ b/pkg/analysis_server/test/edit/format_test.dart
@@ -46,6 +46,26 @@ main() {
});
}
+ Future test_formatNoSelection() async {
+ addTestFile('''
+main() { int x = 3; }
+''');
+ await waitForTasksFinished();
+ EditFormatResult formatResult = _formatAt(0, 0);
+
+ expect(formatResult.edits, isNotNull);
+ expect(formatResult.edits, hasLength(1));
+
+ SourceEdit edit = formatResult.edits[0];
+ expect(edit.replacement, equals('''
+main() {
+ int x = 3;
+}
+'''));
+ expect(formatResult.selectionOffset, equals(0));
+ expect(formatResult.selectionLength, equals(0));
+ }
+
Future test_formatSimple() {
addTestFile('''
main() { int x = 3; }
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698