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

Unified Diff: pkg/analysis_services/test/refactoring/abstract_rename.dart

Issue 472613002: Update analysis server and integration tests to match new ChangeContentOverlay. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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_services/test/correction/fix_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analysis_services/test/refactoring/abstract_rename.dart
diff --git a/pkg/analysis_services/test/refactoring/abstract_rename.dart b/pkg/analysis_services/test/refactoring/abstract_rename.dart
index 4c8e40200534f2f1ef41d7d28d8dc172e2b3fbc4..eb3c2fb02ab90677ed976dd518730787b9861df8 100644
--- a/pkg/analysis_services/test/refactoring/abstract_rename.dart
+++ b/pkg/analysis_services/test/refactoring/abstract_rename.dart
@@ -12,7 +12,6 @@ import 'package:analyzer/file_system/file_system.dart';
import 'package:analyzer/src/generated/ast.dart';
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/source.dart';
-import 'package:collection/collection.dart';
import 'package:unittest/unittest.dart';
import 'abstract_refactoring.dart';
@@ -36,7 +35,7 @@ class RenameRefactoringTest extends RefactoringTest {
File file = provider.getResource(path);
Source source = file.createSource();
String ini = context.getContents(source).data;
- String actualCode = _applyEdits(ini, fileEdit.edits);
+ String actualCode = Edit.applySequence(ini, fileEdit.edits);
expect(actualCode, expectedCode);
}
@@ -62,7 +61,9 @@ class RenameRefactoringTest extends RefactoringTest {
FileEdit fileEdit = refactoringChange.getFileEdit(testFile);
expect(fileEdit, isNotNull);
// validate resulting code
- String actualCode = _applyEdits(testCode, fileEdit.edits);
+ // TODO(paulberry): should the code under test be responsible for sorting
+ // the edits?
+ String actualCode = Edit.applySorted(testCode, fileEdit.edits);
expect(actualCode, expectedCode);
}
@@ -109,15 +110,4 @@ class RenameRefactoringTest extends RefactoringTest {
//// AnalysisContext context = getAnalysisContext();
//// assertChangeResult(context, compositeChange, source, expected);
// }
-
- String _applyEdits(String code, List<Edit> edits) {
- // TODO(scheglov) extract and reuse in assists and fixes tests
- mergeSort(edits, compare: (a, b) => a.offset - b.offset);
- edits.reversed.forEach((Edit edit) {
- code = code.substring(0, edit.offset) +
- edit.replacement +
- code.substring(edit.end);
- });
- return code;
- }
}
« no previous file with comments | « pkg/analysis_services/test/correction/fix_test.dart ('k') | pkg/pkg.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698