| Index: pkg/analysis_server/test/services/refactoring/move_file_test.dart
|
| diff --git a/pkg/analysis_server/test/services/refactoring/move_file_test.dart b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
|
| index 9b42a64de1ad674f01ec5609fa4f81ac7967a449..08a84c0092446e7cc357660ff92b2b2ffa9bd384 100644
|
| --- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
|
| +++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
|
| @@ -29,7 +29,7 @@ main() {
|
| class MoveFileTest extends RefactoringTest {
|
| MoveFileRefactoring refactoring;
|
|
|
| - test_definingUnit() {
|
| + test_definingUnit() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| String pathB = '/project/000/1111/b.dart';
|
| String pathC = '/project/000/1111/22/c.dart';
|
| @@ -51,11 +51,11 @@ part '/absolute/uri.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertNoFileChange(pathA);
|
| - assertFileChangeResult(pathB, "import '22/new_name.dart';");
|
| - assertNoFileChange(pathC);
|
| - assertFileChangeResult(testFile, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertNoFileChange(pathA);
|
| + assertFileChangeResult(pathB, "import '22/new_name.dart';");
|
| + assertNoFileChange(pathC);
|
| + assertFileChangeResult(testFile, '''
|
| library lib;
|
| import 'dart:math';
|
| import 'c.dart';
|
| @@ -63,10 +63,9 @@ export '../333/d.dart';
|
| part '../a.dart';
|
| part '/absolute/uri.dart';
|
| ''');
|
| - });
|
| }
|
|
|
| - test_importedLibrary() {
|
| + test_importedLibrary() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/sub/folder/test.dart';
|
| addSource(pathA, '''
|
| @@ -76,15 +75,14 @@ import 'sub/folder/test.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/project/000/new/folder/name/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertFileChangeResult(pathA, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertFileChangeResult(pathA, '''
|
| import '../new/folder/name/new_name.dart';
|
| ''');
|
| - assertNoFileChange(testFile);
|
| - });
|
| + assertNoFileChange(testFile);
|
| }
|
|
|
| - test_importedLibrary_down() {
|
| + test_importedLibrary_down() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/test.dart';
|
| addSource(pathA, '''
|
| @@ -94,15 +92,14 @@ import 'test.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertFileChangeResult(pathA, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertFileChangeResult(pathA, '''
|
| import '22/new_name.dart';
|
| ''');
|
| - assertNoFileChange(testFile);
|
| - });
|
| + assertNoFileChange(testFile);
|
| }
|
|
|
| - test_importedLibrary_package() {
|
| + test_importedLibrary_package() async {
|
| // configure packages
|
| testFile = '/packages/my_pkg/aaa/test.dart';
|
| provider.newFile(testFile, '');
|
| @@ -123,15 +120,14 @@ import 'package:my_pkg/aaa/test.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/packages/my_pkg/bbb/ccc/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertFileChangeResult(pathA, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertFileChangeResult(pathA, '''
|
| import 'package:my_pkg/bbb/ccc/new_name.dart';
|
| ''');
|
| - assertNoFileChange(testFile);
|
| - });
|
| + assertNoFileChange(testFile);
|
| }
|
|
|
| - test_importedLibrary_up() {
|
| + test_importedLibrary_up() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/22/test.dart';
|
| addSource(pathA, '''
|
| @@ -141,15 +137,14 @@ import '22/test.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertFileChangeResult(pathA, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertFileChangeResult(pathA, '''
|
| import 'new_name.dart';
|
| ''');
|
| - assertNoFileChange(testFile);
|
| - });
|
| + assertNoFileChange(testFile);
|
| }
|
|
|
| - test_sourcedUnit() {
|
| + test_sourcedUnit() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/22/test.dart';
|
| addSource(pathA, '''
|
| @@ -159,15 +154,14 @@ part '22/test.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertFileChangeResult(pathA, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertFileChangeResult(pathA, '''
|
| part '22/new_name.dart';
|
| ''');
|
| - assertNoFileChange(testFile);
|
| - });
|
| + assertNoFileChange(testFile);
|
| }
|
|
|
| - test_sourcedUnit_multipleLibraries() {
|
| + test_sourcedUnit_multipleLibraries() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| String pathB = '/project/000/b.dart';
|
| testFile = '/project/000/1111/22/test.dart';
|
| @@ -181,26 +175,22 @@ part '1111/22/test.dart';
|
| _performAnalysis();
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| - return _assertSuccessfulRefactoring().then((_) {
|
| - assertFileChangeResult(pathA, '''
|
| + await _assertSuccessfulRefactoring();
|
| + assertFileChangeResult(pathA, '''
|
| part '22/new_name.dart';
|
| ''');
|
| - assertFileChangeResult(pathB, '''
|
| + assertFileChangeResult(pathB, '''
|
| part '1111/22/new_name.dart';
|
| ''');
|
| - assertNoFileChange(testFile);
|
| - });
|
| + assertNoFileChange(testFile);
|
| }
|
|
|
| /**
|
| * Checks that all conditions are OK.
|
| */
|
| - Future _assertSuccessfulRefactoring() {
|
| - return assertRefactoringConditionsOK().then((_) {
|
| - return refactoring.createChange().then((SourceChange refactoringChange) {
|
| - this.refactoringChange = refactoringChange;
|
| - });
|
| - });
|
| + Future _assertSuccessfulRefactoring() async {
|
| + await assertRefactoringConditionsOK();
|
| + refactoringChange = await refactoring.createChange();
|
| }
|
|
|
| void _createRefactoring(String newName) {
|
|
|