Chromium Code Reviews| 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 42f4d3dacebe5110e9f5422f3e96a138052108eb..cc1f3ff50bc7048d94390adbba20f9a7714bc2bc 100644 |
| --- a/pkg/analysis_server/test/services/correction/fix_test.dart |
| +++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
| @@ -5561,6 +5561,21 @@ class LintFixTest extends BaseFixProcessorTest { |
| new LintCode(lintCode, '<ignored>')); |
| } |
| + test_addRequiredAnnotation() async { |
| + String src = ''' |
| +void function({String /*LINT*/param}) { |
| + assert(param != null); |
| +} |
| +'''; |
| + await findLint(src, LintNames.always_require_non_null_named_parameters); |
| + await applyFix(DartFixKind.LINT_ADD_REQUIRED); |
| + verifyResult(''' |
| +void function({@required String param}) { |
| + assert(param != null); |
| +} |
| +'''); |
| + } |
| + |
| test_lint_addMissingOverride_field() async { |
| String src = ''' |
| class abstract Test { |
| @@ -5795,6 +5810,49 @@ bad() async { |
| '''); |
| } |
| + test_removeEmptyElse_newLine() async { |
| + String src = ''' |
| +void foo(bool cond) { |
| + if (cond) { |
| + // |
| + } |
| + else /*LINT*/; |
| +} |
| +'''; |
| + await findLint(src, LintNames.avoid_empty_else); |
| + |
| + await applyFix(DartFixKind.REMOVE_EMPTY_ELSE); |
| + |
| + verifyResult(''' |
| +void foo(bool cond) { |
| + if (cond) { |
| + // |
| + } |
| +} |
| +'''); |
| + } |
| + |
| + test_removeEmptyElse_sameLine() async { |
| + String src = ''' |
| +void foo(bool cond) { |
| + if (cond) { |
| + // |
| + } else /*LINT*/; |
|
scheglov
2017/08/29 17:05:22
Is the lint reported for empty else blocks?
Brian Wilkerson
2017/08/29 17:16:46
It isn't currently, but I think it should be.
|
| +} |
| +'''; |
| + await findLint(src, LintNames.avoid_empty_else); |
| + |
| + await applyFix(DartFixKind.REMOVE_EMPTY_ELSE); |
| + |
| + verifyResult(''' |
| +void foo(bool cond) { |
| + if (cond) { |
| + // |
| + } |
| +} |
| +'''); |
| + } |
| + |
| test_removeEmptyStatement_insideBlock() async { |
| String src = ''' |
| void foo() { |