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

Side by Side Diff: pkg/analysis_server/test/services/refactoring/abstract_refactoring.dart

Issue 515733002: 'Inline Local' refactoring. (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library test.services.refactoring; 5 library test.services.refactoring;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 8
9 import 'package:analysis_server/src/protocol.dart'; 9 import 'package:analysis_server/src/protocol.dart';
10 import 'package:analysis_server/src/services/correction/status.dart'; 10 import 'package:analysis_server/src/services/correction/status.dart';
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 */ 104 */
105 void assertTestChangeResult(String expectedCode) { 105 void assertTestChangeResult(String expectedCode) {
106 // prepare FileEdit 106 // prepare FileEdit
107 SourceFileEdit fileEdit = refactoringChange.getFileEdit(testFile); 107 SourceFileEdit fileEdit = refactoringChange.getFileEdit(testFile);
108 expect(fileEdit, isNotNull); 108 expect(fileEdit, isNotNull);
109 // validate resulting code 109 // validate resulting code
110 String actualCode = SourceEdit.applySequence(testCode, fileEdit.edits); 110 String actualCode = SourceEdit.applySequence(testCode, fileEdit.edits);
111 expect(actualCode, expectedCode); 111 expect(actualCode, expectedCode);
112 } 112 }
113 113
114 /**
115 * Checks that all conditions of [refactoring] are OK and the result of
116 * applying the [Change] to [testUnit] is [expectedCode].
117 */
118 Future assertSuccessfulRefactoring(String expectedCode) {
119 return assertRefactoringConditionsOK().then((_) {
120 return refactoring.createChange().then((SourceChange change) {
121 this.refactoringChange = change;
122 assertTestChangeResult(expectedCode);
123 });
124 });
125 }
126
114 void indexTestUnit(String code) { 127 void indexTestUnit(String code) {
115 resolveTestUnit(code); 128 resolveTestUnit(code);
116 index.indexUnit(context, testUnit); 129 index.indexUnit(context, testUnit);
117 } 130 }
118 131
119 void indexUnit(String file, String code) { 132 void indexUnit(String file, String code) {
120 Source source = addSource(file, code); 133 Source source = addSource(file, code);
121 CompilationUnit unit = resolveLibraryUnit(source); 134 CompilationUnit unit = resolveLibraryUnit(source);
122 index.indexUnit(context, unit); 135 index.indexUnit(context, unit);
123 } 136 }
124 137
125 void setUp() { 138 void setUp() {
126 super.setUp(); 139 super.setUp();
127 index = createLocalMemoryIndex(); 140 index = createLocalMemoryIndex();
128 searchEngine = new SearchEngineImpl(index); 141 searchEngine = new SearchEngineImpl(index);
129 } 142 }
130 } 143 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698