Chromium Code Reviews| 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 8f3d30effc84565a00271d856921811798fcc27f..28b95c4033dff7630dc5fe77336d77b16917d4a0 100644 |
| --- a/pkg/analysis_server/test/services/correction/fix_test.dart |
| +++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
| @@ -85,11 +85,13 @@ bool test() { |
| List<SourceFileEdit> fileEdits = change.edits; |
| expect(fileEdits, hasLength(1)); |
| + String fileContent = testCode; |
| if (target != null) { |
| expect(target, fileEdits.first.file); |
| + fileContent = provider.getFile(target).readAsStringSync(); |
| } |
| - resultCode = SourceEdit.applySequence(testCode, change.edits[0].edits); |
| + resultCode = SourceEdit.applySequence(fileContent, change.edits[0].edits); |
| // verify |
| expect(resultCode, expected); |
| } |
| @@ -1630,6 +1632,39 @@ main(A a) { |
| '''); |
| } |
| + test_createField_getter_qualified_instance_differentLibrary() async { |
|
scheglov
2017/08/09 15:52:07
There were two changes - for fields and for getter
Brian Wilkerson
2017/08/09 15:56:33
Not the way the code is currently written, but I'v
|
| + addSource('/other.dart', ''' |
| +/** |
| + * A comment to push the offset of the braces for the following class |
| + * declaration past the end of the content of the test file. Used to catch an |
| + * index out of bounds exception that occurs when using the test source instead |
| + * of the target source to compute the location at which to insert the field. |
| + */ |
| +class A { |
| +} |
| +'''); |
| + await resolveTestUnit(''' |
| +import 'other.dart'; |
| +main(A a) { |
| + int v = a.test; |
| +} |
| +'''); |
| + await assertHasFix( |
| + DartFixKind.CREATE_FIELD, |
| + ''' |
| +/** |
| + * A comment to push the offset of the braces for the following class |
| + * declaration past the end of the content of the test file. Used to catch an |
| + * index out of bounds exception that occurs when using the test source instead |
| + * of the target source to compute the location at which to insert the field. |
| + */ |
| +class A { |
| + int test; |
| +} |
| +''', |
| + target: '/other.dart'); |
| + } |
| + |
| test_createField_getter_qualified_instance_dynamicType() async { |
| await resolveTestUnit(''' |
| class A { |