| OLD | NEW |
| 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.rename; | 5 library test.services.refactoring.rename; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'package:analysis_server/src/protocol2.dart' show SourceEdit; | 9 import 'package:analysis_server/src/protocol2.dart' show SourceEdit; |
| 10 import 'package:analysis_server/src/services/correction/change.dart'; | 10 import 'package:analysis_server/src/services/correction/change.dart'; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 * with the given [path], and it results the [expectedCode]. | 30 * with the given [path], and it results the [expectedCode]. |
| 31 */ | 31 */ |
| 32 void assertFileChangeResult(String path, String expectedCode) { | 32 void assertFileChangeResult(String path, String expectedCode) { |
| 33 // prepare FileEdit | 33 // prepare FileEdit |
| 34 FileEdit fileEdit = refactoringChange.getFileEdit(path); | 34 FileEdit fileEdit = refactoringChange.getFileEdit(path); |
| 35 expect(fileEdit, isNotNull); | 35 expect(fileEdit, isNotNull); |
| 36 // validate resulting code | 36 // validate resulting code |
| 37 File file = provider.getResource(path); | 37 File file = provider.getResource(path); |
| 38 Source source = file.createSource(); | 38 Source source = file.createSource(); |
| 39 String ini = context.getContents(source).data; | 39 String ini = context.getContents(source).data; |
| 40 String actualCode = applySequence(ini, fileEdit.edits); | 40 String actualCode = SourceEdit.applySequence(ini, fileEdit.edits); |
| 41 expect(actualCode, expectedCode); | 41 expect(actualCode, expectedCode); |
| 42 } | 42 } |
| 43 | 43 |
| 44 /** | 44 /** |
| 45 * Asserts that [refactoringChange] does not contain a [FileEdit] for the file | 45 * Asserts that [refactoringChange] does not contain a [FileEdit] for the file |
| 46 * with the given [path]. | 46 * with the given [path]. |
| 47 */ | 47 */ |
| 48 void assertNoFileChange(String path) { | 48 void assertNoFileChange(String path) { |
| 49 FileEdit fileEdit = refactoringChange.getFileEdit(path); | 49 FileEdit fileEdit = refactoringChange.getFileEdit(path); |
| 50 expect(fileEdit, isNull); | 50 expect(fileEdit, isNull); |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // void assertChangeResult(Change change, Source source, String expected) | 133 // void assertChangeResult(Change change, Source source, String expected) |
| 134 // { | 134 // { |
| 135 // SourceChange sourceChange = getSourceChange(compositeChange, source); | 135 // SourceChange sourceChange = getSourceChange(compositeChange, source); |
| 136 // assertNotNull("No change for: " + source.toString(), sourceChange); | 136 // assertNotNull("No change for: " + source.toString(), sourceChange); |
| 137 // String sourceResult = getChangeResult(context, source, sourceChange); | 137 // String sourceResult = getChangeResult(context, source, sourceChange); |
| 138 // assertEquals(expected, sourceResult); | 138 // assertEquals(expected, sourceResult); |
| 139 //// AnalysisContext context = getAnalysisContext(); | 139 //// AnalysisContext context = getAnalysisContext(); |
| 140 //// assertChangeResult(context, compositeChange, source, expected); | 140 //// assertChangeResult(context, compositeChange, source, expected); |
| 141 // } | 141 // } |
| 142 } | 142 } |
| OLD | NEW |