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

Side by Side Diff: pkg/analysis_server/test/services/correction/fix_test.dart

Issue 1281313002: Fix regression in import fixups introduced by .packages support. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Cleaner fix Created 5 years, 4 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
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.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.correction.fix; 5 library test.services.correction.fix;
6 6
7 import 'package:analysis_server/edit/fix/fix_core.dart'; 7 import 'package:analysis_server/edit/fix/fix_core.dart';
8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError; 8 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
9 import 'package:analysis_server/src/services/correction/fix.dart'; 9 import 'package:analysis_server/src/services/correction/fix.dart';
10 import 'package:analysis_server/src/services/correction/fix_internal.dart'; 10 import 'package:analysis_server/src/services/correction/fix_internal.dart';
(...skipping 4388 matching lines...) Expand 10 before | Expand all | Expand 10 after
4399 * `/packages/my_pkg/lib` folder. 4399 * `/packages/my_pkg/lib` folder.
4400 */ 4400 */
4401 void _configureMyPkg(String myLibCode) { 4401 void _configureMyPkg(String myLibCode) {
4402 provider.newFile('/packages/my_pkg/lib/my_lib.dart', myLibCode); 4402 provider.newFile('/packages/my_pkg/lib/my_lib.dart', myLibCode);
4403 // configure SourceFactory 4403 // configure SourceFactory
4404 Folder myPkgFolder = provider.getResource('/packages/my_pkg/lib'); 4404 Folder myPkgFolder = provider.getResource('/packages/my_pkg/lib');
4405 UriResolver pkgResolver = new PackageMapUriResolver(provider, { 4405 UriResolver pkgResolver = new PackageMapUriResolver(provider, {
4406 'my_pkg': [myPkgFolder] 4406 'my_pkg': [myPkgFolder]
4407 }); 4407 });
4408 context.sourceFactory = new SourceFactory( 4408 context.sourceFactory = new SourceFactory(
4409 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]); 4409 [AbstractContextTest.SDK_RESOLVER, pkgResolver, resourceResolver]);
4410 // force 'my_pkg' resolution 4410 // force 'my_pkg' resolution
4411 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';"); 4411 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';");
4412 } 4412 }
4413 4413
4414 AnalysisError _findErrorToFix() { 4414 AnalysisError _findErrorToFix() {
4415 List<AnalysisError> errors = context.computeErrors(testSource); 4415 List<AnalysisError> errors = context.computeErrors(testSource);
4416 if (errorFilter != null) { 4416 if (errorFilter != null) {
4417 errors = errors.where(errorFilter).toList(); 4417 errors = errors.where(errorFilter).toList();
4418 } 4418 }
4419 expect(errors, hasLength(1)); 4419 expect(errors, hasLength(1));
4420 return errors[0]; 4420 return errors[0];
4421 } 4421 }
4422 4422
4423 List<Position> _findResultPositions(List<String> searchStrings) { 4423 List<Position> _findResultPositions(List<String> searchStrings) {
4424 List<Position> positions = <Position>[]; 4424 List<Position> positions = <Position>[];
4425 for (String search in searchStrings) { 4425 for (String search in searchStrings) {
4426 int offset = resultCode.indexOf(search); 4426 int offset = resultCode.indexOf(search);
4427 positions.add(new Position(testFile, offset)); 4427 positions.add(new Position(testFile, offset));
4428 } 4428 }
4429 return positions; 4429 return positions;
4430 } 4430 }
4431 4431
4432 void _performAnalysis() { 4432 void _performAnalysis() {
4433 while (context.performAnalysisTask().hasMoreWork); 4433 while (context.performAnalysisTask().hasMoreWork);
4434 } 4434 }
4435 } 4435 }
OLDNEW
« no previous file with comments | « pkg/analysis_server/lib/src/services/correction/util.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698