| 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 20dbdb3a97a738d3434794fc82caede982bd28f9..b3a192b3e449d4addc9a71d80053806b08053901 100644
|
| --- a/pkg/analysis_server/test/edit/format_test.dart
|
| +++ b/pkg/analysis_server/test/edit/format_test.dart
|
| @@ -14,9 +14,10 @@ import 'package:unittest/unittest.dart' hide ERROR;
|
|
|
| import '../analysis_abstract.dart';
|
| import '../mocks.dart';
|
| +import '../utils.dart';
|
|
|
| main() {
|
| - groupSep = ' | ';
|
| + initializeTestEnvironment();
|
| defineReflectiveTests(FormatTest);
|
| }
|
|
|
| @@ -31,6 +32,24 @@ class FormatTest extends AbstractAnalysisTest {
|
| handler = new EditDomainHandler(server);
|
| }
|
|
|
| + 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_noOp() {
|
| // Already formatted source
|
| addTestFile('''
|
| @@ -86,24 +105,6 @@ main() {
|
| });
|
| }
|
|
|
| - 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 =
|
| @@ -115,9 +116,11 @@ main() { int x =
|
| });
|
| }
|
|
|
| - EditFormatResult _formatAt(int selectionOffset, int selectionLength, {int lineLength}) {
|
| + EditFormatResult _formatAt(int selectionOffset, int selectionLength,
|
| + {int lineLength}) {
|
| Request request = new EditFormatParams(
|
| - testFile, selectionOffset, selectionLength, lineLength: lineLength).toRequest('0');
|
| + testFile, selectionOffset, selectionLength,
|
| + lineLength: lineLength).toRequest('0');
|
| Response response = handleSuccessfulRequest(request);
|
| return new EditFormatResult.fromResponse(response);
|
| }
|
|
|