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

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

Issue 1020243004: Report separate UNUSED_CATCH_CLAUSE and UNUSED_CATCH_STACK hints. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: tweak 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error.dart » ('j') | 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/src/protocol.dart' hide AnalysisError; 7 import 'package:analysis_server/src/protocol.dart' hide AnalysisError;
8 import 'package:analysis_server/src/services/correction/fix.dart'; 8 import 'package:analysis_server/src/services/correction/fix.dart';
9 import 'package:analyzer/file_system/file_system.dart'; 9 import 'package:analyzer/file_system/file_system.dart';
10 import 'package:analyzer/source/package_map_resolver.dart'; 10 import 'package:analyzer/source/package_map_resolver.dart';
(...skipping 3423 matching lines...) Expand 10 before | Expand all | Expand 10 after
3434 new PackageMapUriResolver(provider, {'my_pkg': [myPkgFolder]}); 3434 new PackageMapUriResolver(provider, {'my_pkg': [myPkgFolder]});
3435 context.sourceFactory = new SourceFactory( 3435 context.sourceFactory = new SourceFactory(
3436 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]); 3436 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]);
3437 // force 'my_pkg' resolution 3437 // force 'my_pkg' resolution
3438 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';"); 3438 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';");
3439 } 3439 }
3440 3440
3441 AnalysisError _findErrorToFix() { 3441 AnalysisError _findErrorToFix() {
3442 List<AnalysisError> errors = context.computeErrors(testSource); 3442 List<AnalysisError> errors = context.computeErrors(testSource);
3443 errors.removeWhere((error) { 3443 errors.removeWhere((error) {
3444 return error.errorCode == HintCode.UNUSED_ELEMENT || 3444 return error.errorCode == HintCode.UNUSED_CATCH_CLAUSE ||
3445 error.errorCode == HintCode.UNUSED_CATCH_STACK ||
3446 error.errorCode == HintCode.UNUSED_ELEMENT ||
3445 error.errorCode == HintCode.UNUSED_FIELD || 3447 error.errorCode == HintCode.UNUSED_FIELD ||
3446 error.errorCode == HintCode.UNUSED_LOCAL_VARIABLE; 3448 error.errorCode == HintCode.UNUSED_LOCAL_VARIABLE;
3447 }); 3449 });
3448 if (errorFilter != null) { 3450 if (errorFilter != null) {
3449 errors = errors.where(errorFilter).toList(); 3451 errors = errors.where(errorFilter).toList();
3450 } 3452 }
3451 expect(errors, hasLength(1)); 3453 expect(errors, hasLength(1));
3452 return errors[0]; 3454 return errors[0];
3453 } 3455 }
3454 3456
3455 List<Position> _findResultPositions(List<String> searchStrings) { 3457 List<Position> _findResultPositions(List<String> searchStrings) {
3456 List<Position> positions = <Position>[]; 3458 List<Position> positions = <Position>[];
3457 for (String search in searchStrings) { 3459 for (String search in searchStrings) {
3458 int offset = resultCode.indexOf(search); 3460 int offset = resultCode.indexOf(search);
3459 positions.add(new Position(testFile, offset)); 3461 positions.add(new Position(testFile, offset));
3460 } 3462 }
3461 return positions; 3463 return positions;
3462 } 3464 }
3463 } 3465 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698