Add a failing "move file" refactoring test for dartbug.com/37121
Change-Id: I88aa52e96c09ea6eec03013bfd3c3a3e205b08e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/106981
Commit-Queue: Jaime Wren <jwren@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
diff --git a/pkg/analysis_server/test/services/refactoring/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
index 6f6fe1f..f49c238 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -345,6 +345,54 @@
''');
}
+ // Failing test for http://dartbug.com/37121
+ @failingTest
+ test_renaming_part_that_uses_uri_in_part_of_2() async {
+ // If the file is a part in a library, and the part-of directive uses a URI
+ // rather than a library name, that will need updating too (if the relative
+ // path to the parent changes).
+ String pathA = convertPath('/home/test/000/1111/a.dart');
+ testFile = convertPath('/home/test/000/1111/test.dart');
+ addSource(pathA, '''
+part of 'test.dart';
+''');
+ await resolveTestUnit('''
+part 'a.dart';
+''');
+ // perform refactoring
+ _createRefactoring('/home/test/000/1111/22/test.dart');
+ await _assertSuccessfulRefactoring();
+ assertFileChangeResult(pathA, '''
+part of '22/test.dart';
+''');
+ assertFileChangeResult(testFile, '''
+part '../a.dart';
+''');
+ }
+
+ test_renaming_part_that_uses_uri_in_part_of_3() async {
+ // If the file is a part in a library, and the part-of directive uses a URI
+ // rather than a library name, that will need updating too (if the relative
+ // path to the parent changes).
+ String pathA = convertPath('/home/test/000/1111/a.dart');
+ testFile = convertPath('/home/test/000/1111/test.dart');
+ addSource(pathA, '''
+part 'test.dart';
+''');
+ await resolveTestUnit('''
+part of 'a.dart';
+''');
+ // perform refactoring
+ _createRefactoring('/home/test/000/1111/22/test.dart');
+ await _assertSuccessfulRefactoring();
+ assertFileChangeResult(pathA, '''
+part '22/test.dart';
+''');
+ assertFileChangeResult(testFile, '''
+part of '../a.dart';
+''');
+ }
+
Future _assertFailedRefactoring(RefactoringProblemSeverity expectedSeverity,
{String expectedMessage}) async {
RefactoringStatus status = await refactoring.checkAllConditions();