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

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

Issue 586863002: Try to restore 'package:' URI reference to the file being moved. (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
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/move_file.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.move_files; 5 library test.services.refactoring.move_files;
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/refactoring/refactoring.dart'; 10 import 'package:analysis_server/src/services/refactoring/refactoring.dart';
11 import 'package:analyzer/file_system/file_system.dart';
12 import 'package:analyzer/source/package_map_resolver.dart';
11 import 'package:analyzer/src/generated/engine.dart'; 13 import 'package:analyzer/src/generated/engine.dart';
14 import 'package:analyzer/src/generated/source.dart';
12 import 'package:unittest/unittest.dart'; 15 import 'package:unittest/unittest.dart';
13 16
17 import '../../abstract_context.dart';
14 import '../../reflective_tests.dart'; 18 import '../../reflective_tests.dart';
15 import 'abstract_refactoring.dart'; 19 import 'abstract_refactoring.dart';
16 20
17 21
18 main() { 22 main() {
19 groupSep = ' | '; 23 groupSep = ' | ';
20 runReflectiveTests(MoveFileTest); 24 runReflectiveTests(MoveFileTest);
21 } 25 }
22 26
23 27
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 // perform refactoring 95 // perform refactoring
92 _createRefactoring('/project/000/1111/22/new_name.dart'); 96 _createRefactoring('/project/000/1111/22/new_name.dart');
93 return _assertSuccessfulRefactoring().then((_) { 97 return _assertSuccessfulRefactoring().then((_) {
94 assertFileChangeResult(pathA, ''' 98 assertFileChangeResult(pathA, '''
95 import '22/new_name.dart'; 99 import '22/new_name.dart';
96 '''); 100 ''');
97 assertNoFileChange(testFile); 101 assertNoFileChange(testFile);
98 }); 102 });
99 } 103 }
100 104
105 test_importedLibrary_package() {
106 // configure packages
107 testFile = '/packages/my_pkg/aaa/test.dart';
108 File testFileRes = provider.newFile(testFile, '');
109 Map<String, List<Folder>> packageMap = {
110 'my_pkg': [provider.getResource('/packages/my_pkg')]
111 };
112 context.sourceFactory = new SourceFactory(
113 [
114 AbstractContextTest.SDK_RESOLVER,
115 resourceResolver,
116 new PackageMapUriResolver(provider, packageMap)]);
117 // do testing
118 String pathA = '/project/bin/a.dart';
119 addSource(pathA, '''
120 import 'package:my_pkg/aaa/test.dart';
121 ''');
122 addTestSource('');
123 _performAnalysis();
124 // perform refactoring
125 _createRefactoring('/packages/my_pkg/bbb/ccc/new_name.dart');
126 return _assertSuccessfulRefactoring().then((_) {
127 assertFileChangeResult(pathA, '''
128 import 'package:my_pkg/bbb/ccc/new_name.dart';
129 ''');
130 assertNoFileChange(testFile);
131 });
132 }
133
101 test_importedLibrary_up() { 134 test_importedLibrary_up() {
102 String pathA = '/project/000/1111/a.dart'; 135 String pathA = '/project/000/1111/a.dart';
103 testFile = '/project/000/1111/22/test.dart'; 136 testFile = '/project/000/1111/22/test.dart';
104 addSource(pathA, ''' 137 addSource(pathA, '''
105 import '22/test.dart'; 138 import '22/test.dart';
106 '''); 139 ''');
107 addTestSource(''); 140 addTestSource('');
108 _performAnalysis(); 141 _performAnalysis();
109 // perform refactoring 142 // perform refactoring
110 _createRefactoring('/project/000/1111/new_name.dart'); 143 _createRefactoring('/project/000/1111/new_name.dart');
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 break; 215 break;
183 } 216 }
184 for (ChangeNotice notice in result.changeNotices) { 217 for (ChangeNotice notice in result.changeNotices) {
185 if (notice.source.fullName.startsWith('/project/')) { 218 if (notice.source.fullName.startsWith('/project/')) {
186 index.indexUnit(context, notice.compilationUnit); 219 index.indexUnit(context, notice.compilationUnit);
187 } 220 }
188 } 221 }
189 } 222 }
190 } 223 }
191 } 224 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/refactoring/move_file.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698