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

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

Issue 1154303005: Add lineLength parameter to edit.format request (issue 23519) (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 7 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/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 8d9d0119aa21d9204ed5fbcd2d2eb580c46cfa40..20dbdb3a97a738d3434794fc82caede982bd28f9 100644
--- a/pkg/analysis_server/test/edit/format_test.dart
+++ b/pkg/analysis_server/test/edit/format_test.dart
@@ -31,7 +31,7 @@ class FormatTest extends AbstractAnalysisTest {
handler = new EditDomainHandler(server);
}
- Future test_formatNoOp() {
+ Future test_format_noOp() {
// Already formatted source
addTestFile('''
main() {
@@ -45,7 +45,7 @@ main() {
});
}
- Future test_formatNoSelection() async {
+ Future test_format_noSelection() async {
addTestFile('''
main() { int x = 3; }
''');
@@ -65,7 +65,7 @@ main() {
expect(formatResult.selectionLength, equals(0));
}
- Future test_formatSimple() {
+ Future test_format_simple() {
addTestFile('''
main() { int x = 3; }
''');
@@ -86,7 +86,25 @@ main() {
});
}
- Future test_withErrors() {
+ Future test_format_longLine() {
+ String content = '''
+fun(firstParam, secondParam, thirdParam, fourthParam) {
+ if (firstParam.noNull && secondParam.noNull && thirdParam.noNull && fourthParam.noNull) {}
+}
+''';
+ addTestFile(content);
+ return waitForTasksFinished().then((_) {
+ EditFormatResult formatResult = _formatAt(0, 3, lineLength: 100);
+
+ expect(formatResult.edits, isNotNull);
+ expect(formatResult.edits, hasLength(0));
+
+ expect(formatResult.selectionOffset, equals(0));
+ expect(formatResult.selectionLength, equals(3));
+ });
+ }
+
+ Future test_format_withErrors() {
addTestFile('''
main() { int x =
''');
@@ -97,9 +115,9 @@ main() { int x =
});
}
- EditFormatResult _formatAt(int selectionOffset, int selectionLength) {
+ EditFormatResult _formatAt(int selectionOffset, int selectionLength, {int lineLength}) {
Request request = new EditFormatParams(
- testFile, selectionOffset, selectionLength).toRequest('0');
+ testFile, selectionOffset, selectionLength, lineLength: lineLength).toRequest('0');
Response response = handleSuccessfulRequest(request);
return new EditFormatResult.fromResponse(response);
}

Powered by Google App Engine
This is Rietveld 408576698