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

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

Issue 2538143003: Issue 27903. Use shared logic for computing new method location. (Closed)
Patch Set: Created 4 years 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/util.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 dc65a97999e07210baad30889d9bb33a2f457873..3923162b3fff672bcf104b2d9fd00f03609bc69f 100644
--- a/pkg/analysis_server/test/services/correction/fix_test.dart
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart
@@ -4601,8 +4601,7 @@ class A<T> {
}
class B {
- void process(Map items) {
- }
+ void process(Map items) {}
Brian Wilkerson 2016/11/30 18:22:57 It would be good to have some tests in which there
}
''');
}
@@ -4628,8 +4627,7 @@ class A<T> {
}
class B {
- dynamic compute() {
- }
+ dynamic compute() {}
}
''');
}
@@ -4644,8 +4642,7 @@ class A {
}
}
-class B {
-}
+class B {}
''');
await assertHasFix(
DartFixKind.CREATE_METHOD,
@@ -4659,8 +4656,7 @@ class A {
}
class B {
- void process(List<int> items) {
- }
+ void process(List<int> items) {}
}
''');
}
@@ -4683,8 +4679,26 @@ class A<T> {
process(items);
}
- void process(List<T> items) {
+ void process(List<T> items) {}
+}
+''');
}
+
+ test_undefinedMethod_createQualified_emptyClassBody() async {
+ resolveTestUnit('''
+class A {}
+main() {
+ A.myUndefinedMethod();
+}
+''');
+ await assertHasFix(
+ DartFixKind.CREATE_METHOD,
+ '''
+class A {
+ static void myUndefinedMethod() {}
+}
+main() {
+ A.myUndefinedMethod();
}
''');
}
@@ -4701,8 +4715,7 @@ main() {
DartFixKind.CREATE_METHOD,
'''
class A {
- static void myUndefinedMethod() {
- }
+ static void myUndefinedMethod() {}
}
main() {
A.myUndefinedMethod();
@@ -4725,8 +4738,7 @@ main() {
class A {
foo() {}
- static void myUndefinedMethod() {
- }
+ static void myUndefinedMethod() {}
}
main() {
A.myUndefinedMethod();
@@ -4746,8 +4758,7 @@ main(A a) {
DartFixKind.CREATE_METHOD,
'''
class A {
- void myUndefinedMethod() {
- }
+ void myUndefinedMethod() {}
}
main(A a) {
a.myUndefinedMethod();
@@ -4797,8 +4808,7 @@ class D {
bar(c1.x, c2.x);
}
- void bar(int x, int x2) {
- }
+ void bar(int x, int x2) {}
}''');
}
@@ -4818,8 +4828,7 @@ class A {
myUndefinedMethod(0, 1.0, '3');
}
- void myUndefinedMethod(int i, double d, String s) {
- }
+ void myUndefinedMethod(int i, double d, String s) {}
}
''');
// linked positions
@@ -4864,8 +4873,7 @@ class A {
myUndefinedMethod(0, bbb: 1.0, ccc: '2');
}
- void myUndefinedMethod(int i, {double bbb, String ccc}) {
- }
+ void myUndefinedMethod(int i, {double bbb, String ccc}) {}
}
''');
// linked positions
@@ -4908,8 +4916,7 @@ class A {
int v = myUndefinedMethod();
}
- int myUndefinedMethod() {
- }
+ int myUndefinedMethod() {}
}
''');
// linked positions
@@ -4930,8 +4937,7 @@ class A {
class A {
static var f = myUndefinedMethod();
- static myUndefinedMethod() {
- }
+ static myUndefinedMethod() {}
}
''');
}
@@ -4952,8 +4958,7 @@ class A {
myUndefinedMethod();
}
- static void myUndefinedMethod() {
- }
+ static void myUndefinedMethod() {}
}
''');
}
@@ -4971,8 +4976,7 @@ main() {
DartFixKind.CREATE_METHOD,
'''
class A {
- void myUndefinedMethod() {
- }
+ void myUndefinedMethod() {}
}
main() {
var a = new A();
@@ -5018,8 +5022,7 @@ library test2;
import 'test3.dart' as bbb;
export 'test3.dart';
class D {
- void foo(bbb.E e) {
- }
+ void foo(bbb.E e) {}
}
''');
}
@@ -5052,8 +5055,7 @@ main(test2.D d, test2.E e) {
r'''
library test2;
class D {
- void foo(E e) {
- }
+ void foo(E e) {}
}
class E {}
''');
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698