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

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

Issue 728503003: Report HintCode.UNUSED_FIELD (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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
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:analysis_server/src/services/index/index.dart'; 9 import 'package:analysis_server/src/services/index/index.dart';
10 import 'package:analysis_server/src/services/index/local_memory_index.dart'; 10 import 'package:analysis_server/src/services/index/local_memory_index.dart';
(...skipping 2286 matching lines...) Expand 10 before | Expand all | Expand 10 after
2297 }); 2297 });
2298 context.sourceFactory = new SourceFactory( 2298 context.sourceFactory = new SourceFactory(
2299 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]); 2299 [AbstractContextTest.SDK_RESOLVER, resourceResolver, pkgResolver]);
2300 // force 'my_pkg' resolution 2300 // force 'my_pkg' resolution
2301 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';"); 2301 addSource('/tmp/other.dart', "import 'package:my_pkg/my_lib.dart';");
2302 } 2302 }
2303 2303
2304 AnalysisError _findErrorToFix() { 2304 AnalysisError _findErrorToFix() {
2305 List<AnalysisError> errors = context.computeErrors(testSource); 2305 List<AnalysisError> errors = context.computeErrors(testSource);
2306 errors.removeWhere((error) { 2306 errors.removeWhere((error) {
2307 return error.errorCode == HintCode.UNUSED_LOCAL_VARIABLE; 2307 return error.errorCode == HintCode.UNUSED_ELEMENT ||
2308 error.errorCode == HintCode.UNUSED_FIELD ||
2309 error.errorCode == HintCode.UNUSED_LOCAL_VARIABLE;
2308 }); 2310 });
2309 if (checkHasSingleError) { 2311 if (checkHasSingleError) {
2310 expect(errors, hasLength(1)); 2312 expect(errors, hasLength(1));
2311 } 2313 }
2312 return errors[0]; 2314 return errors[0];
2313 } 2315 }
2314 2316
2315 List<Position> _findResultPositions(List<String> searchStrings) { 2317 List<Position> _findResultPositions(List<String> searchStrings) {
2316 List<Position> positions = <Position>[]; 2318 List<Position> positions = <Position>[];
2317 for (String search in searchStrings) { 2319 for (String search in searchStrings) {
2318 int offset = resultCode.indexOf(search); 2320 int offset = resultCode.indexOf(search);
2319 positions.add(new Position(testFile, offset)); 2321 positions.add(new Position(testFile, offset));
2320 } 2322 }
2321 return positions; 2323 return positions;
2322 } 2324 }
2323 2325
2324 void _indexTestUnit(String code) { 2326 void _indexTestUnit(String code) {
2325 resolveTestUnit(code); 2327 resolveTestUnit(code);
2326 index.indexUnit(context, testUnit); 2328 index.indexUnit(context, testUnit);
2327 } 2329 }
2328 } 2330 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/generated/error.dart » ('j') | pkg/analyzer/test/generated/resolver_test.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698