| Index: pkg/analysis_services/test/correction/fix_test.dart
|
| diff --git a/pkg/analysis_services/test/correction/fix_test.dart b/pkg/analysis_services/test/correction/fix_test.dart
|
| index f843cac243af3489dddac0976a9a624ca4dd5cbc..f006941c6f6df6813af7654e8b547f2af157de39 100644
|
| --- a/pkg/analysis_services/test/correction/fix_test.dart
|
| +++ b/pkg/analysis_services/test/correction/fix_test.dart
|
| @@ -1189,6 +1189,34 @@ void myUndefinedFunction() {
|
| ''');
|
| }
|
|
|
| + void test_undefinedFunction_useSimilar_fromImport() {
|
| + _indexTestUnit('''
|
| +main() {
|
| + pritn(0);
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +main() {
|
| + print(0);
|
| +}
|
| +''');
|
| + }
|
| +
|
| + void test_undefinedFunction_useSimilar_thisLibrary() {
|
| + _indexTestUnit('''
|
| +myFunction() {}
|
| +main() {
|
| + myFuntcion();
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +myFunction() {}
|
| +main() {
|
| + myFunction();
|
| +}
|
| +''');
|
| + }
|
| +
|
| void test_undefinedMethod_createQualified_fromClass() {
|
| _indexTestUnit('''
|
| class A {
|
| @@ -1387,6 +1415,106 @@ main() {
|
| ''');
|
| }
|
|
|
| + void test_undefinedMethod_useSimilar_ignoreOperators() {
|
| + _indexTestUnit('''
|
| +main(Object object) {
|
| + object.then();
|
| +}
|
| +''');
|
| + assertNoFix(FixKind.CHANGE_TO);
|
| + }
|
| +
|
| + void test_undefinedMethod_useSimilar_qualified() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + myMethod() {}
|
| +}
|
| +main() {
|
| + A a = new A();
|
| + a.myMehtod();
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +class A {
|
| + myMethod() {}
|
| +}
|
| +main() {
|
| + A a = new A();
|
| + a.myMethod();
|
| +}
|
| +''');
|
| + }
|
| +
|
| + void test_undefinedClass_useSimilar_fromThisLibrary() {
|
| + _indexTestUnit('''
|
| +class MyClass {}
|
| +main() {
|
| + MyCalss v = null;
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +class MyClass {}
|
| +main() {
|
| + MyClass v = null;
|
| +}
|
| +''');
|
| + }
|
| +
|
| + void test_undefinedClass_useSimilar_fromImport() {
|
| + _indexTestUnit('''
|
| +main() {
|
| + Stirng s = 'abc';
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +main() {
|
| + String s = 'abc';
|
| +}
|
| +''');
|
| + }
|
| +
|
| + void test_undefinedMethod_useSimilar_unqualified_superClass() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + myMethod() {}
|
| +}
|
| +class B extends A {
|
| + main() {
|
| + myMehtod();
|
| + }
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +class A {
|
| + myMethod() {}
|
| +}
|
| +class B extends A {
|
| + main() {
|
| + myMethod();
|
| + }
|
| +}
|
| +''');
|
| + }
|
| +
|
| + void test_undefinedMethod_useSimilar_unqualified_thisClass() {
|
| + _indexTestUnit('''
|
| +class A {
|
| + myMethod() {}
|
| + main() {
|
| + myMehtod();
|
| + }
|
| +}
|
| +''');
|
| + assertHasFix(FixKind.CHANGE_TO, '''
|
| +class A {
|
| + myMethod() {}
|
| + main() {
|
| + myMethod();
|
| + }
|
| +}
|
| +''');
|
| + }
|
| +
|
| void test_useEffectiveIntegerDivision() {
|
| _indexTestUnit('''
|
| main() {
|
|
|