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

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

Issue 2256463002: Issue 26335. Insert an empty line if the class body is a single line. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Generate empty constructor body. Created 4 years, 4 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 5244097290c6518adeacff56a2d9c881f6f79b62..5bde96667d304eec57c3c2bfd8981c18ac41ee2e 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -1011,8 +1011,7 @@ main() {
class A {
int field;
- A(int i, double d) {
- }
+ A(int i, double d);
method() {}
}
@@ -1035,8 +1034,7 @@ main() {
DartFixKind.CREATE_CONSTRUCTOR,
'''
class A {
- A.named(int i, double d) {
- }
+ A.named(int i, double d);
method() {}
}
@@ -1047,6 +1045,26 @@ main() {
_assertLinkedGroup(change.linkedEditGroups[0], ['named(int ', 'named(1']);
}
+ test_createConstructor_named_emptyClassBody() async {
+ resolveTestUnit('''
+class A {}
+main() {
+ new A.named(1);
+}
+''');
+ await assertHasFix(
+ DartFixKind.CREATE_CONSTRUCTOR,
+ '''
+class A {
+ A.named(int i);
+}
+main() {
+ new A.named(1);
+}
+''');
+ _assertLinkedGroup(change.linkedEditGroups[0], ['named(int ', 'named(1']);
+ }
+
test_createConstructorForFinalFields_inTopLevelMethod() async {
resolveTestUnit('''
main() {
@@ -2569,6 +2587,30 @@ class B extends A {
}
}
+ test_createMissingOverrides_method_emptyClassBody() async {
+ resolveTestUnit('''
+abstract class A {
+ void foo();
+}
+
+class B extends A {}
+''');
+ await assertHasFix(
+ DartFixKind.CREATE_MISSING_OVERRIDES,
+ '''
+abstract class A {
+ void foo();
+}
+
+class B extends A {
+ @override
+ void foo() {
+ // TODO: implement foo
+ }
+}
+''');
+ }
+
test_createMissingOverrides_operator() async {
resolveTestUnit('''
abstract 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