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

Unified Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 3004293002: Add fixes for two more lint rules (Closed)
Patch Set: Created 3 years, 3 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/services/correction/fix_internal.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/services/correction/fix_test.dart
diff --git a/pkg/analysis_server/test/services/correction/fix_test.dart b/pkg/analysis_server/test/services/correction/fix_test.dart
index cc1f3ff50bc7048d94390adbba20f9a7714bc2bc..8f63aeb8da9545e04663332cf781759fcef70b56 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -5810,6 +5810,60 @@ bad() async {
''');
}
+ test_removeEmptyCatch_newLine() async {
+ String src = '''
+void foo() {
+ try {}
+ catch (e) {/*LINT*/}
+ finally {}
+}
+''';
+ await findLint(src, LintNames.empty_catches);
+
+ await applyFix(DartFixKind.REMOVE_EMPTY_CATCH);
+
+ verifyResult('''
+void foo() {
+ try {}
+ finally {}
+}
+''');
+ }
+
+ test_removeEmptyCatch_sameLine() async {
+ String src = '''
+void foo() {
+ try {} catch (e) {/*LINT*/} finally {}
+}
+''';
+ await findLint(src, LintNames.empty_catches);
+
+ await applyFix(DartFixKind.REMOVE_EMPTY_CATCH);
+
+ verifyResult('''
+void foo() {
+ try {} finally {}
+}
+''');
+ }
+
+ test_removeEmptyConstructorBody() async {
+ String src = '''
+class C {
+ C() {/*LINT*/}
+}
+''';
+ await findLint(src, LintNames.empty_constructor_bodies);
+
+ await applyFix(DartFixKind.REMOVE_EMPTY_CONSTRUCTOR_BODY);
+
+ verifyResult('''
+class C {
+ C();
+}
+''');
+ }
+
test_removeEmptyElse_newLine() async {
String src = '''
void foo(bool cond) {
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/fix_internal.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698