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 d5c9b7804154864f60b70482dab97a87af053c52..97ea82cdbfe130d00512f9dfc2254f123b101fb4 100644 |
| --- a/pkg/analysis_server/test/services/correction/fix_test.dart |
| +++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
| @@ -287,6 +287,28 @@ class Test { |
| _assertLinkedGroup(change.linkedEditGroups[0], ['Test v =', 'Test {']); |
| } |
| + void test_createConstructor_forFinalFields() { |
|
Brian Wilkerson
2015/03/16 13:17:55
Does this handle the case where there is already a
scheglov
2015/03/16 14:55:22
No, not this fix.
I plan to add a separate one for
|
| + errorFilter = (AnalysisError error) { |
| + return error.message.contains("'a'"); |
| + }; |
| + resolveTestUnit(''' |
| +class Test { |
| + final int a; |
| + final int b = 2; |
| + final int c; |
| +} |
| +'''); |
| + assertHasFix(FixKind.CREATE_CONSTRUCTOR_FOR_FINAL_FIELDS, ''' |
| +class Test { |
| + final int a; |
| + final int b = 2; |
| + final int c; |
| + |
| + Test(this.a, this.c); |
| +} |
| +'''); |
| + } |
| + |
| void test_createConstructor_insteadOfSyntheticDefault() { |
| resolveTestUnit(''' |
| class A { |
| @@ -2974,26 +2996,26 @@ class A { |
| int index = 0; |
| _assertLinkedGroup( |
| change.linkedEditGroups[index++], ['void myUndefinedMethod(']); |
| - _assertLinkedGroup(change.linkedEditGroups[index++], |
| - ['myUndefinedMethod(0', 'myUndefinedMethod(int']); |
| + _assertLinkedGroup(change.linkedEditGroups[index++], [ |
| + 'myUndefinedMethod(0', |
| + 'myUndefinedMethod(int' |
| + ]); |
| _assertLinkedGroup(change.linkedEditGroups[index++], [ |
| 'int i' |
| ], expectedSuggestions( |
| LinkedEditSuggestionKind.TYPE, ['int', 'num', 'Object', 'Comparable'])); |
| _assertLinkedGroup(change.linkedEditGroups[index++], ['i,']); |
| - _assertLinkedGroup(change.linkedEditGroups[index++], [ |
| - 'double d' |
| - ], expectedSuggestions(LinkedEditSuggestionKind.TYPE, [ |
| + _assertLinkedGroup(change.linkedEditGroups[index++], ['double d'], |
| + expectedSuggestions(LinkedEditSuggestionKind.TYPE, [ |
| 'double', |
| 'num', |
| 'Object', |
| 'Comparable' |
| ])); |
| _assertLinkedGroup(change.linkedEditGroups[index++], ['d,']); |
| - _assertLinkedGroup(change.linkedEditGroups[index++], [ |
| - 'String s' |
| - ], expectedSuggestions( |
| - LinkedEditSuggestionKind.TYPE, ['String', 'Object', 'Comparable'])); |
| + _assertLinkedGroup(change.linkedEditGroups[index++], ['String s'], |
| + expectedSuggestions( |
| + LinkedEditSuggestionKind.TYPE, ['String', 'Object', 'Comparable'])); |
| _assertLinkedGroup(change.linkedEditGroups[index++], ['s)']); |
| } |
| @@ -3017,8 +3039,10 @@ class A { |
| '''); |
| // linked positions |
| _assertLinkedGroup(change.linkedEditGroups[0], ['int myUndefinedMethod(']); |
| - _assertLinkedGroup(change.linkedEditGroups[1], |
| - ['myUndefinedMethod();', 'myUndefinedMethod() {']); |
| + _assertLinkedGroup(change.linkedEditGroups[1], [ |
| + 'myUndefinedMethod();', |
| + 'myUndefinedMethod() {' |
| + ]); |
| } |
| void test_undefinedMethod_createUnqualified_staticFromField() { |