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

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

Issue 484733003: Import analysis_services.dart into analysis_server.dart. (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
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
deleted file mode 100644
index f5599eb216f624f67b0053695290067551584b10..0000000000000000000000000000000000000000
--- a/pkg/analysis_services/test/refactoring/abstract_rename.dart
+++ /dev/null
@@ -1,154 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE file.
-
-library test.services.refactoring.rename;
-
-import 'dart:async';
-
-import 'package:analysis_services/correction/change.dart';
-import 'package:analysis_services/refactoring/refactoring.dart';
-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:unittest/unittest.dart';
-
-import 'abstract_refactoring.dart';
-
-
-/**
- * The base class for all [RenameRefactoring] tests.
- */
-class RenameRefactoringTest extends RefactoringTest {
- RenameRefactoring refactoring;
-
- /**
- * Asserts that [refactoringChange] contains a [FileEdit] for the file
- * with the given [path], and it results the [expectedCode].
- */
- void assertFileChangeResult(String path, String expectedCode) {
- // prepare FileEdit
- FileEdit fileEdit = refactoringChange.getFileEdit(path);
- expect(fileEdit, isNotNull);
- // validate resulting code
- File file = provider.getResource(path);
- Source source = file.createSource();
- String ini = context.getContents(source).data;
- String actualCode = Edit.applySequence(ini, fileEdit.edits);
- expect(actualCode, expectedCode);
- }
-
- /**
- * Asserts that [refactoringChange] does not contain a [FileEdit] for the file
- * with the given [path].
- */
- void assertNoFileChange(String path) {
- FileEdit fileEdit = refactoringChange.getFileEdit(path);
- expect(fileEdit, isNull);
- }
-
- /**
- * Asserts that [refactoring] has potential edits in [testFile] at offset
- * of the given [searches].
- */
- void assertPotentialEdits(List<String> searches) {
- Set<int> expectedOffsets = new Set<int>();
- for (String search in searches) {
- int offset = findOffset(search);
- expectedOffsets.add(offset);
- }
- // remove offset marked as potential
- for (String potentialId in refactoring.potentialEditIds) {
- Edit edit = findEditById(potentialId);
- expect(edit, isNotNull);
- expectedOffsets.remove(edit.offset);
- }
- // all potential offsets are marked as such
- expect(expectedOffsets, isEmpty);
- }
-
- /**
- * Checks that all conditions are OK and the result of applying the [Change]
- * to [testUnit] is [expectedCode].
- */
- Future assertSuccessfulRename(String expectedCode) {
- return assertRefactoringConditionsOK().then((_) {
- return refactoring.createChange().then((Change refactoringChange) {
- this.refactoringChange = refactoringChange;
- assertTestChangeResult(expectedCode);
- });
- });
- }
-
- /**
- * Asserts that [refactoringChange] contains a [FileEdit] for [testFile], and
- * it results the [expectedCode].
- */
- void assertTestChangeResult(String expectedCode) {
- // prepare FileEdit
- FileEdit fileEdit = refactoringChange.getFileEdit(testFile);
- expect(fileEdit, isNotNull);
- // validate resulting code
- String actualCode = Edit.applySequence(testCode, fileEdit.edits);
- expect(actualCode, expectedCode);
- }
-
- /**
- * Creates a new [RenameRefactoring] in [refactoring] for the [Element] of
- * the [SimpleIdentifier] at the given [search] pattern.
- */
- void createRenameRefactoringAtString(String search) {
- SimpleIdentifier identifier = findIdentifier(search);
- Element element = identifier.bestElement;
- // TODO(scheglov) uncomment later
-// if (element instanceof PrefixElement) {
-// element = IndexContributor.getImportElement(identifier);
-// }
- createRenameRefactoringForElement(element);
- }
-
- /**
- * Creates a new [RenameRefactoring] in [refactoring] for [element].
- * Fails if no [RenameRefactoring] can be created.
- */
- void createRenameRefactoringForElement(Element element) {
- refactoring = new RenameRefactoring(searchEngine, element);
- expect(refactoring, isNotNull, reason: "No refactoring for '$element'.");
- }
-
- /**
- * Returns the [Edit] with the given [id], maybe `null`.
- */
- Edit findEditById(String id) {
- for (FileEdit fileEdit in refactoringChange.fileEdits) {
- for (Edit edit in fileEdit.edits) {
- if (edit.id == id) {
- return edit;
- }
- }
- }
- return null;
- }
-
-// /**
-// * Asserts result of applying [change] to [testCode].
-// */
-// void assertTestChangeResult(Change change, String expected)
-// {
-// assertChangeResult(change, testSource, expected);
-// }
-//
-// /**
-// * Asserts result of applying [change] to [source].
-// */
-// void assertChangeResult(Change change, Source source, String expected)
-// {
-// SourceChange sourceChange = getSourceChange(compositeChange, source);
-// assertNotNull("No change for: " + source.toString(), sourceChange);
-// String sourceResult = getChangeResult(context, source, sourceChange);
-// assertEquals(expected, sourceResult);
-//// AnalysisContext context = getAnalysisContext();
-//// assertChangeResult(context, compositeChange, source, expected);
-// }
-}

Powered by Google App Engine
This is Rietveld 408576698