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

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

Issue 1018433002: Quick Fix for adding field formal parameters of not initialized final fields. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 97ea82cdbfe130d00512f9dfc2254f123b101fb4..7406f2f50d553b22ad472e527ec1f52275ed7d3f 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -97,6 +97,63 @@ bool test() {
verifyNoTestUnitErrors = false;
}
+ void test_addFieldFormalParameters_hasRequiredParameter() {
+ resolveTestUnit('''
+class Test {
+ final int a;
+ final int b;
+ final int c;
+ Test(this.a);
+}
+''');
+ assertHasFix(FixKind.ADD_FIELD_FORMAL_PARAMETERS, '''
+class Test {
+ final int a;
+ final int b;
+ final int c;
+ Test(this.a, this.b, this.c);
+}
+''');
+ }
+
+ void test_addFieldFormalParameters_noParameters() {
+ resolveTestUnit('''
+class Test {
+ final int a;
+ final int b;
+ final int c;
+ Test();
+}
+''');
+ assertHasFix(FixKind.ADD_FIELD_FORMAL_PARAMETERS, '''
+class Test {
+ final int a;
+ final int b;
+ final int c;
+ Test(this.a, this.b, this.c);
+}
+''');
+ }
+
+ void test_addFieldFormalParameters_noRequiredParameter() {
+ resolveTestUnit('''
+class Test {
+ final int a;
+ final int b;
+ final int c;
+ Test([this.c]);
+}
+''');
+ assertHasFix(FixKind.ADD_FIELD_FORMAL_PARAMETERS, '''
+class Test {
+ final int a;
+ final int b;
+ final int c;
+ Test(this.a, this.b, [this.c]);
+}
+''');
+ }
+
void test_addSync_blockFunctionBody() {
resolveTestUnit('''
foo() {}
« 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