Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(277)

Unified Diff: pkg/analysis_server/test/edit/refactoring_test.dart

Issue 611823003: Include 'potentialEdits' into refactoring feedback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_server/test/edit/refactoring_test.dart
diff --git a/pkg/analysis_server/test/edit/refactoring_test.dart b/pkg/analysis_server/test/edit/refactoring_test.dart
index 0acf5e15e85b0fa702396b913f82bf4127de7a71..d987a6b3b1558d18585029c07032c16d1d0575de 100644
--- a/pkg/analysis_server/test/edit/refactoring_test.dart
+++ b/pkg/analysis_server/test/edit/refactoring_test.dart
@@ -1026,6 +1026,60 @@ class A {
''');
}
+ test_classMember_method() {
+ addTestFile('''
+class A {
+ test() {}
+ main() {
+ test();
+ }
+}
+main(A a) {
+ a.test();
+}
+''');
+ return assertSuccessfulRefactoring(() {
+ return sendRenameRequest('test() {}', 'newName');
+ }, '''
+class A {
+ newName() {}
+ main() {
+ newName();
+ }
+}
+main(A a) {
+ a.newName();
+}
+''');
+ }
+
+ test_classMember_method_potential() {
+ addTestFile('''
+class A {
+ test() {}
+}
+main(A a, a2) {
+ a.test();
+ a2.test(); // a2
+}
+''');
+ return getRefactoringResult(() {
+ return sendRenameRequest('test() {}', 'newName');
+ }).then((result) {
+ assertResultProblemsOK(result);
+ // prepare potential edit ID
+ List<String> potentialIds = result.potentialEdits;
+ expect(potentialIds, hasLength(1));
+ String potentialId = potentialIds[0];
+ // find potential edit
+ SourceChange change = result.change;
+ SourceEdit potentialEdit = _findEditWithId(change, potentialId);
+ expect(potentialEdit, isNotNull);
+ expect(potentialEdit.offset, findOffset('test(); // a2'));
+ expect(potentialEdit.length, 4);
+ });
+ }
+
test_classMember_setter() {
addTestFile('''
class A {
@@ -1289,6 +1343,18 @@ main() {
});
});
}
+
+ SourceEdit _findEditWithId(SourceChange change, String id) {
+ SourceEdit potentialEdit;
+ change.edits.forEach((fileEdit) {
+ fileEdit.edits.forEach((edit) {
+ if (edit.id == id) {
+ potentialEdit = edit;
+ }
+ });
+ });
+ return potentialEdit;
+ }
}
« no previous file with comments | « pkg/analysis_server/lib/src/edit/edit_domain.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698