[CMSR] Check the second file for ConvertFormalParametersToNamed.
Change-Id: I07a477701939cf2f40c8eeb77faf5a2d38290a5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/310700
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/src/services/refactoring/convert_formal_parameters_test.dart b/pkg/analysis_server/test/src/services/refactoring/convert_formal_parameters_test.dart
index 2ff3133..04f77e8 100644
--- a/pkg/analysis_server/test/src/services/refactoring/convert_formal_parameters_test.dart
+++ b/pkg/analysis_server/test/src/services/refactoring/convert_formal_parameters_test.dart
@@ -95,7 +95,8 @@
Future<void> test_multiple_files() async {
// TODO(scheglov) Unify behind `testPackageLibPath`
- addSource(getFile('$projectFolderPath/lib/a.dart').path, r'''
+ final a = getFile('$projectFolderPath/lib/a.dart');
+ addSource(a.path, r'''
import 'main.dart';
void f2() {
@@ -111,7 +112,6 @@
}
''');
- // TODO(scheglov) check changes to all files.
await _executeRefactoring(r'''
void test({required int a}) {}
@@ -119,6 +119,27 @@
test(a: 0);
}
''');
+
+ // TODO(scheglov) Ask me, if you want more of this opinion.
+ // This is bad code.
+ // I don't like using content for verifying refactoring results.
+ // We need to check all changes, without a way to check only some portion.
+ // See how _writeSourceChangeToBuffer is done.
+ //
+ // And addSource() above is another hack that we rely on to support these
+ // checks here.
+ // I don't like these too.
+ // We have newFile() already, this should be enough.
+ // Don't invent more way to add files.
+ // I worked hard in DAS legacy tests to get away from it.
+ // Don't add them back.
+ _assertTextExpectation(content[a.path]!, r'''
+import 'main.dart';
+
+void f2() {
+ test(a: 1);
+}
+''');
}
Future<void> test_noTarget_argument() async {