| 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 cbae32f2c3b58e42ea5d98584863ec9df8241d7b..859b8fa41bdefa7c6433516951ec7007f59147bd 100644
|
| --- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
|
| +++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
|
| @@ -12,13 +12,13 @@ import 'package:analyzer/source/package_map_resolver.dart';
|
| import 'package:analyzer/src/generated/engine.dart';
|
| import 'package:analyzer/src/generated/source.dart';
|
| import 'package:test_reflective_loader/test_reflective_loader.dart';
|
| -import 'package:unittest/unittest.dart';
|
|
|
| import '../../abstract_context.dart';
|
| +import '../../utils.dart';
|
| import 'abstract_refactoring.dart';
|
|
|
| main() {
|
| - groupSep = ' | ';
|
| + initializeTestEnvironment();
|
| defineReflectiveTests(MoveFileTest);
|
| }
|
|
|
| @@ -52,7 +52,9 @@ part '/absolute/uri.dart';
|
| assertNoFileChange(pathA);
|
| assertFileChangeResult(pathB, "import '22/new_name.dart';");
|
| assertNoFileChange(pathC);
|
| - assertFileChangeResult(testFile, '''
|
| + assertFileChangeResult(
|
| + testFile,
|
| + '''
|
| library lib;
|
| import 'dart:math';
|
| import 'c.dart';
|
| @@ -65,7 +67,9 @@ part '/absolute/uri.dart';
|
| test_file_importedLibrary() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/sub/folder/test.dart';
|
| - addSource(pathA, '''
|
| + addSource(
|
| + pathA,
|
| + '''
|
| import 'sub/folder/test.dart';
|
| ''');
|
| addTestSource('');
|
| @@ -73,7 +77,9 @@ import 'sub/folder/test.dart';
|
| // perform refactoring
|
| _createRefactoring('/project/000/new/folder/name/new_name.dart');
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pathA, '''
|
| + assertFileChangeResult(
|
| + pathA,
|
| + '''
|
| import '../new/folder/name/new_name.dart';
|
| ''');
|
| assertNoFileChange(testFile);
|
| @@ -82,7 +88,9 @@ import '../new/folder/name/new_name.dart';
|
| test_file_importedLibrary_down() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/test.dart';
|
| - addSource(pathA, '''
|
| + addSource(
|
| + pathA,
|
| + '''
|
| import 'test.dart';
|
| ''');
|
| addTestSource('');
|
| @@ -90,7 +98,9 @@ import 'test.dart';
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pathA, '''
|
| + assertFileChangeResult(
|
| + pathA,
|
| + '''
|
| import '22/new_name.dart';
|
| ''');
|
| assertNoFileChange(testFile);
|
| @@ -110,7 +120,9 @@ import '22/new_name.dart';
|
| ]);
|
| // do testing
|
| String pathA = '/project/bin/a.dart';
|
| - addSource(pathA, '''
|
| + addSource(
|
| + pathA,
|
| + '''
|
| import 'package:my_pkg/aaa/test.dart';
|
| ''');
|
| addTestSource('');
|
| @@ -118,7 +130,9 @@ import 'package:my_pkg/aaa/test.dart';
|
| // perform refactoring
|
| _createRefactoring('/packages/my_pkg/bbb/ccc/new_name.dart');
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pathA, '''
|
| + assertFileChangeResult(
|
| + pathA,
|
| + '''
|
| import 'package:my_pkg/bbb/ccc/new_name.dart';
|
| ''');
|
| assertNoFileChange(testFile);
|
| @@ -127,7 +141,9 @@ import 'package:my_pkg/bbb/ccc/new_name.dart';
|
| test_file_importedLibrary_up() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/22/test.dart';
|
| - addSource(pathA, '''
|
| + addSource(
|
| + pathA,
|
| + '''
|
| import '22/test.dart';
|
| ''');
|
| addTestSource('');
|
| @@ -135,7 +151,9 @@ import '22/test.dart';
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/new_name.dart');
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pathA, '''
|
| + assertFileChangeResult(
|
| + pathA,
|
| + '''
|
| import 'new_name.dart';
|
| ''');
|
| assertNoFileChange(testFile);
|
| @@ -144,7 +162,9 @@ import 'new_name.dart';
|
| test_file_sourcedUnit() async {
|
| String pathA = '/project/000/1111/a.dart';
|
| testFile = '/project/000/1111/22/test.dart';
|
| - addSource(pathA, '''
|
| + addSource(
|
| + pathA,
|
| + '''
|
| library lib;
|
| part '22/test.dart';
|
| ''');
|
| @@ -155,7 +175,9 @@ part of lib;
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pathA, '''
|
| + assertFileChangeResult(
|
| + pathA,
|
| + '''
|
| library lib;
|
| part '22/new_name.dart';
|
| ''');
|
| @@ -166,11 +188,15 @@ part '22/new_name.dart';
|
| String pathA = '/project/000/1111/a.dart';
|
| String pathB = '/project/000/b.dart';
|
| testFile = '/project/000/1111/22/test.dart';
|
| - addSource(pathA, '''
|
| + addSource(
|
| + pathA,
|
| + '''
|
| library lib;
|
| part '22/test.dart';
|
| ''');
|
| - addSource(pathB, '''
|
| + addSource(
|
| + pathB,
|
| + '''
|
| library lib;
|
| part '1111/22/test.dart';
|
| ''');
|
| @@ -181,11 +207,15 @@ part of lib;
|
| // perform refactoring
|
| _createRefactoring('/project/000/1111/22/new_name.dart');
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pathA, '''
|
| + assertFileChangeResult(
|
| + pathA,
|
| + '''
|
| library lib;
|
| part '22/new_name.dart';
|
| ''');
|
| - assertFileChangeResult(pathB, '''
|
| + assertFileChangeResult(
|
| + pathB,
|
| + '''
|
| library lib;
|
| part '1111/22/new_name.dart';
|
| ''');
|
| @@ -195,13 +225,17 @@ part '1111/22/new_name.dart';
|
| test_project() async {
|
| String pubspecPath = '/testName/pubspec.yaml';
|
| String appPath = '/testName/bin/myApp.dart';
|
| - provider.newFile(pubspecPath, '''
|
| + provider.newFile(
|
| + pubspecPath,
|
| + '''
|
| name: testName
|
| version: 0.0.1
|
| description: My pubspec file.
|
| ''');
|
| addSource('/testName/lib/myLib.dart', '');
|
| - addSource(appPath, '''
|
| + addSource(
|
| + appPath,
|
| + '''
|
| import 'package:testName/myLib.dart';
|
| export 'package:testName/myLib.dart';
|
| ''');
|
| @@ -220,12 +254,16 @@ export 'package:testName/myLib.dart';
|
| provider, searchEngine, context, null, '/testName');
|
| refactoring.newFile = '/newName';
|
| await _assertSuccessfulRefactoring();
|
| - assertFileChangeResult(pubspecPath, '''
|
| + assertFileChangeResult(
|
| + pubspecPath,
|
| + '''
|
| name: newName
|
| version: 0.0.1
|
| description: My pubspec file.
|
| ''');
|
| - assertFileChangeResult(appPath, '''
|
| + assertFileChangeResult(
|
| + appPath,
|
| + '''
|
| import 'package:newName/myLib.dart';
|
| export 'package:newName/myLib.dart';
|
| ''');
|
|
|