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

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

Issue 1009833002: Quick Assist for creating a constructor for selected final fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rework into a Quick Fix. Created 5 years, 9 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 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() {
« 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