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 efb89746defa688a896464c7a71373ccc647a84b..5a6c3c0967501d0ca89f7de77f49c23a39a0b290 100644 |
--- a/pkg/analysis_server/test/services/correction/fix_test.dart |
+++ b/pkg/analysis_server/test/services/correction/fix_test.dart |
@@ -162,6 +162,36 @@ class Test { |
'''); |
} |
+ void test_addPartOfDirective() { |
+ String partCode = r''' |
+// Comment first. |
+// Comment second. |
+ |
+class A {} |
+'''; |
+ addSource('/part.dart', partCode); |
+ resolveTestUnit(''' |
+library my.lib; |
+part 'part.dart'; |
+'''); |
+ AnalysisError error = _findErrorToFix(); |
+ fix = _assertHasFix(DartFixKind.ADD_PART_OF, error); |
+ change = fix.change; |
+ // apply to "file" |
+ List<SourceFileEdit> fileEdits = change.edits; |
+ expect(fileEdits, hasLength(1)); |
+ SourceFileEdit fileEdit = change.edits[0]; |
+ expect(fileEdit.file, '/part.dart'); |
+ expect(SourceEdit.applySequence(partCode, fileEdit.edits), r''' |
+// Comment first. |
+// Comment second. |
+ |
+part of my.lib; |
+ |
+class A {} |
+'''); |
+ } |
+ |
void test_addSync_BAD_nullFunctionBody() { |
resolveTestUnit(''' |
var F = await; |