bulk fix for `prefer_adjacent_string_concatenation`
Change-Id: I873d3531307a9685dc0950aa2fc2119af5abdd0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156925
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
diff --git a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
index de2eed6..1ecf7f5 100644
--- a/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
+++ b/pkg/analysis_server/lib/src/services/correction/bulk_fix_processor.dart
@@ -21,6 +21,7 @@
import 'package:analysis_server/src/services/correction/dart/remove_empty_else.dart';
import 'package:analysis_server/src/services/correction/dart/remove_empty_statement.dart';
import 'package:analysis_server/src/services/correction/dart/remove_initializer.dart';
+import 'package:analysis_server/src/services/correction/dart/remove_operator.dart';
import 'package:analysis_server/src/services/correction/dart/remove_type_annotation.dart';
import 'package:analysis_server/src/services/correction/dart/remove_unnecessary_new.dart';
import 'package:analysis_server/src/services/correction/dart/replace_cascade_with_dot.dart';
@@ -62,6 +63,7 @@
LintNames.no_duplicate_case_values: RemoveDuplicateCase.newInstance,
LintNames.null_closures: ReplaceNullWithClosure.newInstance,
LintNames.omit_local_variable_types: ReplaceWithVar.newInstance,
+ LintNames.prefer_adjacent_string_concatenation: RemoveOperator.newInstance,
LintNames.prefer_contains: ConvertToContains.newInstance,
LintNames.prefer_equal_for_default_values:
ReplaceColonWithEquals.newInstance,
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart
new file mode 100644
index 0000000..e8aede6
--- /dev/null
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/remove_operator_test.dart
@@ -0,0 +1,31 @@
+// Copyright (c) 2020, 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.
+
+import 'package:analysis_server/src/services/linter/lint_names.dart';
+import 'package:test_reflective_loader/test_reflective_loader.dart';
+
+import 'bulk_fix_processor.dart';
+
+void main() {
+ defineReflectiveSuite(() {
+ defineReflectiveTests(RemoveOperatorTest);
+ });
+}
+
+@reflectiveTest
+class RemoveOperatorTest extends BulkFixProcessorTest {
+ @override
+ String get lintCode => LintNames.prefer_adjacent_string_concatenation;
+
+ Future<void> test_singleFile() async {
+ await resolveTestUnit('''
+var s = 'a' + 'b';
+var s1 = 'b' + 'c';
+''');
+ await assertHasFix('''
+var s = 'a' 'b';
+var s1 = 'b' 'c';
+''');
+ }
+}
diff --git a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
index f863c88..75eea74 100644
--- a/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
+++ b/pkg/analysis_server/test/src/services/correction/fix/bulk/test_all.dart
@@ -18,6 +18,7 @@
import 'remove_empty_else_test.dart' as remove_empty_else;
import 'remove_empty_statement_test.dart' as remove_empty_statement;
import 'remove_initializer_test.dart' as remove_initializer;
+import 'remove_operator_test.dart' as remove_operator;
import 'remove_type_annotation_test.dart' as remove_type_annotation;
import 'remove_unnecessary_const_test.dart' as remove_unnecessary_const;
import 'remove_unnecessary_new_test.dart' as remove_unnecessary_new;
@@ -40,6 +41,7 @@
remove_empty_constructor_body.main();
remove_empty_else.main();
remove_empty_statement.main();
+ remove_operator.main();
remove_type_annotation.main();
remove_unnecessary_const.main();
remove_unnecessary_new.main();