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

Unified Diff: pkg/analysis_server/test/services/refactoring/move_file_test.dart

Issue 1015513003: Issue 22757. Create pubspec.yaml file change on project rename. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 9 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
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 df7d396fc80ce6ad49e0f79c5e3773b9aae19087..3c3dd3ae22562fc1cda8be7c724d38b02d2f88f3 100644
--- a/pkg/analysis_server/test/services/refactoring/move_file_test.dart
+++ b/pkg/analysis_server/test/services/refactoring/move_file_test.dart
@@ -26,7 +26,7 @@ main() {
class MoveFileTest extends RefactoringTest {
MoveFileRefactoring refactoring;
- test_definingUnit() async {
+ test_file_definingUnit() async {
String pathA = '/project/000/1111/a.dart';
String pathB = '/project/000/1111/b.dart';
String pathC = '/project/000/1111/22/c.dart';
@@ -62,7 +62,7 @@ part '/absolute/uri.dart';
''');
}
- test_importedLibrary() async {
+ test_file_importedLibrary() async {
String pathA = '/project/000/1111/a.dart';
testFile = '/project/000/1111/sub/folder/test.dart';
addSource(pathA, '''
@@ -79,7 +79,7 @@ import '../new/folder/name/new_name.dart';
assertNoFileChange(testFile);
}
- test_importedLibrary_down() async {
+ test_file_importedLibrary_down() async {
String pathA = '/project/000/1111/a.dart';
testFile = '/project/000/1111/test.dart';
addSource(pathA, '''
@@ -96,7 +96,7 @@ import '22/new_name.dart';
assertNoFileChange(testFile);
}
- test_importedLibrary_package() async {
+ test_file_importedLibrary_package() async {
// configure packages
testFile = '/packages/my_pkg/aaa/test.dart';
provider.newFile(testFile, '');
@@ -124,7 +124,7 @@ import 'package:my_pkg/bbb/ccc/new_name.dart';
assertNoFileChange(testFile);
}
- test_importedLibrary_up() async {
+ test_file_importedLibrary_up() async {
String pathA = '/project/000/1111/a.dart';
testFile = '/project/000/1111/22/test.dart';
addSource(pathA, '''
@@ -141,7 +141,7 @@ import 'new_name.dart';
assertNoFileChange(testFile);
}
- test_sourcedUnit() async {
+ test_file_sourcedUnit() async {
String pathA = '/project/000/1111/a.dart';
testFile = '/project/000/1111/22/test.dart';
addSource(pathA, '''
@@ -158,7 +158,7 @@ part '22/new_name.dart';
assertNoFileChange(testFile);
}
- test_sourcedUnit_multipleLibraries() async {
+ test_file_sourcedUnit_multipleLibraries() async {
String pathA = '/project/000/1111/a.dart';
String pathB = '/project/000/b.dart';
testFile = '/project/000/1111/22/test.dart';
@@ -182,6 +182,37 @@ part '1111/22/new_name.dart';
assertNoFileChange(testFile);
}
+ test_project() async {
+ String pubspecPath = '/testName/pubspec.yaml';
+ String appPath = '/testName/bin/myApp.dart';
+ provider.newFile(pubspecPath, '''
+name: testName
+version: 0.0.1
+description: My pubspec file.
+''');
+ addSource('/testName/lib/myLib.dart', '');
+ addSource(appPath, '''
+import 'package:testName/myLib.dart';
+''');
+ addTestSource('');
+ _performAnalysis();
+ // perform refactoring
+ refactoring = new MoveFileRefactoring(
+ provider, searchEngine, context, null, '/testName');
+ refactoring.newFile = '/newName';
+ await _assertSuccessfulRefactoring();
+// print(refactoringChange);
+ assertFileChangeResult(pubspecPath, '''
+name: newName
+version: 0.0.1
+description: My pubspec file.
+''');
+ // TODO(scheglov) update self references
+// assertFileChangeResult(appPath, '''
+//import 'package:newName/myLib.dart';
+//''');
+ }
+
/**
* Checks that all conditions are OK.
*/
@@ -192,7 +223,7 @@ part '1111/22/new_name.dart';
void _createRefactoring(String newName) {
refactoring = new MoveFileRefactoring(
- provider.pathContext, searchEngine, context, testSource);
+ provider, searchEngine, context, testSource, null);
refactoring.newFile = newName;
}
« no previous file with comments | « pkg/analysis_server/pubspec.yaml ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698