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 f1bc9986d0cd44e7aba0a359f5b51374c7404959..da08e995a2520b063da670f0ae74b20c2a4e1555 100644 |
--- a/pkg/analysis_server/test/services/correction/fix_test.dart |
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
@@ -5117,6 +5117,116 @@ class Sub extends Test { |
'''); |
} |
+ test_lint_addMissingOverride_method_with_doc_comment() async { |
+ String src = ''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ /// Doc comment. |
+ void /*LINT*/t() { } |
+} |
+'''; |
+ findLint(src, LintNames.annotate_overrides); |
+ |
+ await applyFix(DartFixKind.LINT_ADD_OVERRIDE); |
+ |
+ verifyResult(''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ /// Doc comment. |
+ @override |
+ void t() { } |
+} |
+'''); |
+ } |
+ |
+ test_lint_addMissingOverride_method_with_doc_comment_2() async { |
+ String src = ''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ /** |
+ * Doc comment. |
+ */ |
+ void /*LINT*/t() { } |
+} |
+'''; |
+ findLint(src, LintNames.annotate_overrides); |
+ |
+ await applyFix(DartFixKind.LINT_ADD_OVERRIDE); |
+ |
+ verifyResult(''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ /** |
+ * Doc comment. |
+ */ |
+ @override |
+ void t() { } |
+} |
+'''); |
+ } |
+ |
+ test_lint_addMissingOverride_method_with_doc_comment_and_metadata() async { |
+ String src = ''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ /// Doc comment. |
+ @foo |
+ void /*LINT*/t() { } |
+} |
+'''; |
+ findLint(src, LintNames.annotate_overrides); |
+ |
+ await applyFix(DartFixKind.LINT_ADD_OVERRIDE); |
+ |
+ verifyResult(''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ /// Doc comment. |
+ @override |
+ @foo |
+ void t() { } |
+} |
+'''); |
+ } |
+ |
+ test_lint_addMissingOverride_method_with_non_doc_comment() async { |
+ String src = ''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ // Non-doc comment. |
+ void /*LINT*/t() { } |
+} |
+'''; |
+ findLint(src, LintNames.annotate_overrides); |
+ |
+ await applyFix(DartFixKind.LINT_ADD_OVERRIDE); |
+ |
+ verifyResult(''' |
+class Test { |
+ void t() { } |
+} |
+class Sub extends Test { |
+ // Non-doc comment. |
+ @override |
+ void t() { } |
+} |
+'''); |
+ } |
+ |
void verifyResult(String expectedResult) { |
expect(resultCode, expectedResult); |
} |