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

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

Issue 2946093002: Fix invalid initializing formal by adding a field (Closed)
Patch Set: cleanup Created 3 years, 6 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 2def8d4569a91c3f3c473f2d7bd605b0684c1d73..84102080a647f0c5d2a93824c02e7869d1f32b8b 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -1957,6 +1957,40 @@ main(C c) {
''');
}
+ test_createField_invalidInitializer_withoutType() async {
+ await resolveTestUnit('''
+class C {
+ C(this.text);
+}
+''');
+ await assertHasFix(
+ DartFixKind.CREATE_FIELD,
+ '''
+class C {
+ var text;
+
+ C(this.text);
+}
+''');
+ }
+
+ test_createField_invalidInitializer_withType() async {
+ await resolveTestUnit('''
+class C {
+ C(String this.text);
+}
+''');
+ await assertHasFix(
+ DartFixKind.CREATE_FIELD,
+ '''
+class C {
+ String text;
+
+ C(String this.text);
+}
+''');
+ }
+
test_createField_setter_generic_BAD() async {
await resolveTestUnit('''
class A {
« 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